Update app.py
Browse files
app.py
CHANGED
@@ -113,13 +113,16 @@ def trigger_translation(translation_module, language_detector, audio_processor_m
|
|
113 |
try:
|
114 |
translated_text = translation_module.translate(user_input_text, source_lang_code, target_lang_code)
|
115 |
if time.time() - start_time > 20: # Timeout after 20 seconds
|
116 |
-
st.
|
|
|
117 |
elif translated_text and len(translated_text.split()) > 2:
|
118 |
st.session_state.translated_text = translated_text
|
119 |
else:
|
120 |
-
st.
|
|
|
121 |
except Exception:
|
122 |
-
st.
|
|
|
123 |
|
124 |
# Handle audio playback with error handling
|
125 |
def play_audio(audio_processor_module):
|
|
|
113 |
try:
|
114 |
translated_text = translation_module.translate(user_input_text, source_lang_code, target_lang_code)
|
115 |
if time.time() - start_time > 20: # Timeout after 20 seconds
|
116 |
+
st.warning("This translation is not possible at this moment. Please try another language.")
|
117 |
+
st.session_state.translated_text = user_input_text
|
118 |
elif translated_text and len(translated_text.split()) > 2:
|
119 |
st.session_state.translated_text = translated_text
|
120 |
else:
|
121 |
+
st.warning("This translation is not possible at this moment. Please try another language.")
|
122 |
+
st.session_state.translated_text = user_input_text
|
123 |
except Exception:
|
124 |
+
st.warning("This translation is not possible at this moment. Please try another language.")
|
125 |
+
st.session_state.translated_text = user_input_text
|
126 |
|
127 |
# Handle audio playback with error handling
|
128 |
def play_audio(audio_processor_module):
|