Spaces:
Runtime error
Runtime error
Commit
·
454ef36
1
Parent(s):
1465757
update TTS
Browse files
app.py
CHANGED
@@ -268,17 +268,22 @@ def text_to_speech_2(text):
|
|
268 |
""",
|
269 |
)
|
270 |
response.raise_for_status()
|
|
|
|
|
|
|
|
|
271 |
except requests.exceptions.RequestException as e:
|
272 |
print(f"Error: {e}")
|
273 |
return None
|
274 |
-
|
275 |
-
|
|
|
276 |
# return response.content
|
277 |
|
278 |
Text2Sound_tool = Tool(
|
279 |
-
name = "Text To Sound",
|
280 |
-
func = Text2Sound,
|
281 |
-
|
282 |
description = "Useful when you need to convert text into sound file."
|
283 |
)
|
284 |
|
|
|
268 |
""",
|
269 |
)
|
270 |
response.raise_for_status()
|
271 |
+
timestr = time.strftime("%Y%m%d-%H%M")
|
272 |
+
with open('sample-' + timestr + '.wav', 'wb') as audio:
|
273 |
+
audio.write(response.content)
|
274 |
+
print ("File Name ", audio.name)
|
275 |
except requests.exceptions.RequestException as e:
|
276 |
print(f"Error: {e}")
|
277 |
return None
|
278 |
+
|
279 |
+
|
280 |
+
return("test.mp3")
|
281 |
# return response.content
|
282 |
|
283 |
Text2Sound_tool = Tool(
|
284 |
+
name = "Text To Sound REST API",
|
285 |
+
# func = Text2Sound,
|
286 |
+
func = text_to_speech_2,
|
287 |
description = "Useful when you need to convert text into sound file."
|
288 |
)
|
289 |
|