Spaces:
Building
Building
Update app.py
Browse files
app.py
CHANGED
@@ -77,7 +77,7 @@ def translate(text, direction, tone):
|
|
77 |
|
78 |
return f"{warning}\n{translation}" if warning else translation
|
79 |
|
80 |
-
#
|
81 |
def tts_via_api(text):
|
82 |
api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
83 |
if not api_token:
|
@@ -92,7 +92,7 @@ def tts_via_api(text):
|
|
92 |
}
|
93 |
|
94 |
response = requests.post(
|
95 |
-
"https://api-inference.huggingface.co/models/
|
96 |
headers=headers,
|
97 |
json=payload
|
98 |
)
|
@@ -102,6 +102,7 @@ def tts_via_api(text):
|
|
102 |
tmp.write(response.content)
|
103 |
return tmp.name
|
104 |
else:
|
|
|
105 |
return None
|
106 |
|
107 |
def transcribe_and_translate(audio_path, direction, tone):
|
|
|
77 |
|
78 |
return f"{warning}\n{translation}" if warning else translation
|
79 |
|
80 |
+
#new tts_via_api function with this:
|
81 |
def tts_via_api(text):
|
82 |
api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
83 |
if not api_token:
|
|
|
92 |
}
|
93 |
|
94 |
response = requests.post(
|
95 |
+
"https://api-inference.huggingface.co/models/espnet/kan-bayashi_ljspeech_vits",
|
96 |
headers=headers,
|
97 |
json=payload
|
98 |
)
|
|
|
102 |
tmp.write(response.content)
|
103 |
return tmp.name
|
104 |
else:
|
105 |
+
print("TTS API Error:", response.status_code, response.text)
|
106 |
return None
|
107 |
|
108 |
def transcribe_and_translate(audio_path, direction, tone):
|