bilal revert all changes of app.py
Browse files
app.py
CHANGED
|
@@ -19,46 +19,6 @@ from utils.export import ResultExporter
|
|
| 19 |
# Import LangChain components
|
| 20 |
from langchain_groq import ChatGroq
|
| 21 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
| 22 |
-
import streamlit as st
|
| 23 |
-
from utils.lang_utils import detect_language, translate_text
|
| 24 |
-
from utils.audio_utils import transcribe_audio
|
| 25 |
-
|
| 26 |
-
st.title("Multilingual and Voice-to-Text Support")
|
| 27 |
-
|
| 28 |
-
# Upload options
|
| 29 |
-
uploaded_audio = st.file_uploader("Upload Audio (MP3)", type=["mp3"])
|
| 30 |
-
user_text = st.text_area("Or Paste Your Text")
|
| 31 |
-
|
| 32 |
-
input_text = ""
|
| 33 |
-
|
| 34 |
-
# If audio is uploaded
|
| 35 |
-
if uploaded_audio:
|
| 36 |
-
with st.spinner("Transcribing audio..."):
|
| 37 |
-
input_text = transcribe_audio(uploaded_audio)
|
| 38 |
-
st.success("Audio transcribed successfully!")
|
| 39 |
-
st.write("Transcribed Text:")
|
| 40 |
-
st.write(input_text)
|
| 41 |
-
|
| 42 |
-
# If text is given
|
| 43 |
-
elif user_text:
|
| 44 |
-
input_text = user_text
|
| 45 |
-
|
| 46 |
-
# If input is received
|
| 47 |
-
if input_text:
|
| 48 |
-
lang = detect_language(input_text)
|
| 49 |
-
st.write(f"Detected Language: `{lang}`")
|
| 50 |
-
|
| 51 |
-
if lang != "en":
|
| 52 |
-
translated = translate_text(input_text)
|
| 53 |
-
st.write("🔁 Translated to English:")
|
| 54 |
-
st.write(translated)
|
| 55 |
-
final_text = translated
|
| 56 |
-
else:
|
| 57 |
-
final_text = input_text
|
| 58 |
-
|
| 59 |
-
# Now pass final_text to your main logic (scoring, summarizing, etc.)
|
| 60 |
-
st.write("✅ You can now proceed with the optimized or summarized output.")
|
| 61 |
-
|
| 62 |
|
| 63 |
class GEOSEOApp:
|
| 64 |
"""Main application class that orchestrates all components"""
|
|
@@ -291,13 +251,14 @@ class GEOSEOApp:
|
|
| 291 |
# Show optimized content
|
| 292 |
optimized_text = result.get("optimized_text", "")
|
| 293 |
# if optimized_text and not analyze_only:
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
|
|
|
| 301 |
|
| 302 |
# Export option
|
| 303 |
if st.button("📥 Export Results"):
|
|
|
|
| 19 |
# Import LangChain components
|
| 20 |
from langchain_groq import ChatGroq
|
| 21 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
class GEOSEOApp:
|
| 24 |
"""Main application class that orchestrates all components"""
|
|
|
|
| 251 |
# Show optimized content
|
| 252 |
optimized_text = result.get("optimized_text", "")
|
| 253 |
# if optimized_text and not analyze_only:
|
| 254 |
+
if optimized_text
|
| 255 |
+
st.markdown("#### ✨ Optimized Content")
|
| 256 |
+
st.text_area(
|
| 257 |
+
"Enhanced version:",
|
| 258 |
+
value=optimized_text,
|
| 259 |
+
height=200,
|
| 260 |
+
key="optimized_output"
|
| 261 |
+
)
|
| 262 |
|
| 263 |
# Export option
|
| 264 |
if st.button("📥 Export Results"):
|