NCTCMumbai
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -19,6 +19,13 @@ api_key = getenv('API_KEY')
|
|
19 |
user_id = getenv('USER_ID')
|
20 |
def bhashini_translate(text: str, from_code: str = "en", to_code: str = "hi") -> dict:
|
21 |
"""Translates text from source language to target language using the Bhashini API."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
print(f'Starting translation process from {from_code} to {to_code}...')
|
23 |
gr.Warning(f'Translating to {to_code}...')
|
24 |
|
|
|
19 |
user_id = getenv('USER_ID')
|
20 |
def bhashini_translate(text: str, from_code: str = "en", to_code: str = "hi") -> dict:
|
21 |
"""Translates text from source language to target language using the Bhashini API."""
|
22 |
+
|
23 |
+
if not text.strip():
|
24 |
+
print('Input text is empty. Please provide valid text for translation.')
|
25 |
+
return {"status_code": 400, "message": "Input text is empty", "translated_content": None, "speech_content": None}
|
26 |
+
else:
|
27 |
+
print('Input text - ',text)
|
28 |
+
print(f'Starting translation process from {from_code} to {to_code}...')
|
29 |
print(f'Starting translation process from {from_code} to {to_code}...')
|
30 |
gr.Warning(f'Translating to {to_code}...')
|
31 |
|