Krishna086 commited on
Commit
926dcae
·
verified ·
1 Parent(s): 6e9785f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -130,7 +130,7 @@ def main():
130
  except Exception as e:
131
  st.error(f"App error: {e}")
132
 
133
- # Function to trigger translation process with progress indicator and timeout
134
  def trigger_translation(translation_module, language_detector, audio_processor_module):
135
  user_input_text = st.session_state.get("user_input_text", "").strip()
136
  if user_input_text:
@@ -145,7 +145,7 @@ def trigger_translation(translation_module, language_detector, audio_processor_m
145
  source_lang_code = next((k for k, v in LANGUAGES.items() if v[0] == source_lang), "en")
146
  target_lang_code = next((k for k, v in LANGUAGES.items() if v[0] == target_lang), "hi")
147
  translated_text = translation_module.translate(user_input_text, source_lang_code, target_lang_code)
148
- if time.time() - start_time > 10: # Timeout after 10 seconds
149
  st.error("Translation took too long, reverting to input.")
150
  translated_text = user_input_text
151
  if translated_text and len(translated_text.split()) > 2: # Basic validation
 
130
  except Exception as e:
131
  st.error(f"App error: {e}")
132
 
133
+ # Function to trigger translation process with progress indicator and adjusted timeout
134
  def trigger_translation(translation_module, language_detector, audio_processor_module):
135
  user_input_text = st.session_state.get("user_input_text", "").strip()
136
  if user_input_text:
 
145
  source_lang_code = next((k for k, v in LANGUAGES.items() if v[0] == source_lang), "en")
146
  target_lang_code = next((k for k, v in LANGUAGES.items() if v[0] == target_lang), "hi")
147
  translated_text = translation_module.translate(user_input_text, source_lang_code, target_lang_code)
148
+ if time.time() - start_time > 15: # Increased timeout to 15 seconds
149
  st.error("Translation took too long, reverting to input.")
150
  translated_text = user_input_text
151
  if translated_text and len(translated_text.split()) > 2: # Basic validation