Update app.py
Browse files
app.py
CHANGED
@@ -99,7 +99,7 @@ def text_to_speech(text, language="en"):
|
|
99 |
return None
|
100 |
|
101 |
# Initialize Streamlit UI
|
102 |
-
st.title("
|
103 |
|
104 |
# Sidebar settings
|
105 |
with st.sidebar:
|
@@ -125,7 +125,7 @@ with st.sidebar:
|
|
125 |
|
126 |
|
127 |
# User context input with example prompts
|
128 |
-
st.subheader("
|
129 |
|
130 |
# Generalized example prompts for easier input
|
131 |
example_prompts = {
|
@@ -201,9 +201,10 @@ if uploaded_file:
|
|
201 |
with st.spinner("Generating audio... π΅"):
|
202 |
# Translate the diagnosis to the target language
|
203 |
translator = Translator()
|
204 |
-
|
|
|
205 |
# Filter out unwanted characters like '#' and '*'
|
206 |
-
filtered_text = ''.join
|
207 |
# Now process the translated text for TTS
|
208 |
audio_bytes = text_to_speech(filtered_text, language)
|
209 |
if audio_bytes:
|
|
|
99 |
return None
|
100 |
|
101 |
# Initialize Streamlit UI
|
102 |
+
st.title("AI-Powered Crop Disease Detection & Diagnosis System")
|
103 |
|
104 |
# Sidebar settings
|
105 |
with st.sidebar:
|
|
|
125 |
|
126 |
|
127 |
# User context input with example prompts
|
128 |
+
st.subheader("Provide Initial Context or Ask a Question")
|
129 |
|
130 |
# Generalized example prompts for easier input
|
131 |
example_prompts = {
|
|
|
201 |
with st.spinner("Generating audio... π΅"):
|
202 |
# Translate the diagnosis to the target language
|
203 |
translator = Translator()
|
204 |
+
diagnosis = diagnosis.text
|
205 |
+
translated_text = translator.translate(diagnosis, dest=language)
|
206 |
# Filter out unwanted characters like '#' and '*'
|
207 |
+
filtered_text = ''.join(c for c in translated_text if c not in ['#', '*'])
|
208 |
# Now process the translated text for TTS
|
209 |
audio_bytes = text_to_speech(filtered_text, language)
|
210 |
if audio_bytes:
|