Spaces:
Runtime error
Runtime error
Ramkumar commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,7 +74,12 @@ def process_audio_or_text(input_text, audio_path, generate_image_flag):
|
|
| 74 |
return tamil_text, f"An error occurred during translation: {str(e)}", None
|
| 75 |
|
| 76 |
elif input_text: # No audio input, so use text input
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
# Generate chatbot response
|
|
@@ -90,7 +95,7 @@ def process_audio_or_text(input_text, audio_path, generate_image_flag):
|
|
| 90 |
if generate_image_flag: # Generate image if the checkbox is checked
|
| 91 |
image = generate_image(translation)
|
| 92 |
|
| 93 |
-
return
|
| 94 |
|
| 95 |
# Custom CSS for improved styling and centered title
|
| 96 |
css = """
|
|
|
|
| 74 |
return tamil_text, f"An error occurred during translation: {str(e)}", None
|
| 75 |
|
| 76 |
elif input_text: # No audio input, so use text input
|
| 77 |
+
try:
|
| 78 |
+
translator = GoogleTranslator(source='ta', target='en')
|
| 79 |
+
translation = translator.translate(input_text)
|
| 80 |
+
except Exception as e:
|
| 81 |
+
return tamil_text, f"An error occurred during translation: {str(e)}", None
|
| 82 |
+
# translation = input_text
|
| 83 |
|
| 84 |
|
| 85 |
# Generate chatbot response
|
|
|
|
| 95 |
if generate_image_flag: # Generate image if the checkbox is checked
|
| 96 |
image = generate_image(translation)
|
| 97 |
|
| 98 |
+
return translation, chatbot_response, image # Return both chatbot response and image (if generated)
|
| 99 |
|
| 100 |
# Custom CSS for improved styling and centered title
|
| 101 |
css = """
|