OuroborosM commited on
Commit
454ef36
·
1 Parent(s): 1465757

update TTS

Browse files
Files changed (1) hide show
  1. app.py +10 -5
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
- print ("Type of File: ", type(response.content))
275
- return("Test TTS: abc.wav")
 
276
  # return response.content
277
 
278
  Text2Sound_tool = Tool(
279
- name = "Text To Sound",
280
- func = Text2Sound,
281
- # func = text_to_speech_2,
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