Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -125,12 +125,12 @@ def translate_text(input_text, input_language):
|
|
| 125 |
Translate text from one language to another.
|
| 126 |
"""
|
| 127 |
try:
|
| 128 |
-
text_translation_result =
|
| 129 |
task="T2TT (Text to Text translation)",
|
| 130 |
input_text=input_text,
|
| 131 |
-
source_language=Auto-detect, #
|
| 132 |
target_language=input_language,
|
| 133 |
-
api_name="/run_text_translation" #
|
| 134 |
)
|
| 135 |
|
| 136 |
translated_text = text_translation_result['translated_text']
|
|
@@ -143,11 +143,11 @@ def convert_text_to_speech(input_text, input_language):
|
|
| 143 |
Convert text to speech in the specified language.
|
| 144 |
"""
|
| 145 |
try:
|
| 146 |
-
text_to_speech_result =
|
| 147 |
task="T2ST (Text to Speech translation)",
|
| 148 |
input_text=input_text,
|
| 149 |
language=input_language,
|
| 150 |
-
api_name="/run_text_to_speech" #
|
| 151 |
)
|
| 152 |
|
| 153 |
# Assuming the API returns a file path or similar identifier for the audio
|
|
|
|
| 125 |
Translate text from one language to another.
|
| 126 |
"""
|
| 127 |
try:
|
| 128 |
+
text_translation_result = seamless_client.predict(
|
| 129 |
task="T2TT (Text to Text translation)",
|
| 130 |
input_text=input_text,
|
| 131 |
+
source_language="Auto-detect", # If auto-detection is supported
|
| 132 |
target_language=input_language,
|
| 133 |
+
api_name="/run_text_translation" # Adjust the API endpoint as needed
|
| 134 |
)
|
| 135 |
|
| 136 |
translated_text = text_translation_result['translated_text']
|
|
|
|
| 143 |
Convert text to speech in the specified language.
|
| 144 |
"""
|
| 145 |
try:
|
| 146 |
+
text_to_speech_result = seamless_client.predict(
|
| 147 |
task="T2ST (Text to Speech translation)",
|
| 148 |
input_text=input_text,
|
| 149 |
language=input_language,
|
| 150 |
+
api_name="/run_text_to_speech" # Adjust the API endpoint as needed
|
| 151 |
)
|
| 152 |
|
| 153 |
# Assuming the API returns a file path or similar identifier for the audio
|