Mira1sen commited on
Commit
105d0ac
1 Parent(s): b8aafac

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. tts_gradio.py +4 -4
tts_gradio.py CHANGED
@@ -166,7 +166,6 @@ def openai(text, name):
166
  # exactly as it was in the original request.
167
  #data = '{\n "model": "tts-1",\n "input": "The quick brown fox jumped over the lazy dog.",\n "voice": "alloy"\n }'
168
  #response = requests.post('https://api.openai.com/v1/audio/speech', headers=headers, data=data)
169
-
170
  return "Success", response
171
 
172
  def elevenlabs(text,name):
@@ -194,7 +193,7 @@ def elevenlabs(text,name):
194
  # for chunk in response.iter_content(chunk_size=CHUNK_SIZE):
195
  # if chunk:
196
  # f.write(chunk)
197
- return "Success", response.iter_content[0]
198
 
199
  def microsoft(text, name, style="Neural"):
200
  """
@@ -221,6 +220,7 @@ def microsoft(text, name, style="Neural"):
221
  headers=headers,
222
  data=data,
223
  )
 
224
  return "Success", response.content
225
 
226
  if __name__ == '__main__':
@@ -264,9 +264,9 @@ if __name__ == '__main__':
264
  tts_submit.click(openai, [tts_input1, tts_input2],
265
  [tts_output1, tts_output2])
266
 
267
- # app.queue(max_size=10)
268
  app.launch(share=True)
269
- # _, audio = openai(all_example,'alloy')
270
  # print(audio)
271
  # with open("test99.mp3", "wb") as f:
272
  # f.write(audio.content)
 
166
  # exactly as it was in the original request.
167
  #data = '{\n "model": "tts-1",\n "input": "The quick brown fox jumped over the lazy dog.",\n "voice": "alloy"\n }'
168
  #response = requests.post('https://api.openai.com/v1/audio/speech', headers=headers, data=data)
 
169
  return "Success", response
170
 
171
  def elevenlabs(text,name):
 
193
  # for chunk in response.iter_content(chunk_size=CHUNK_SIZE):
194
  # if chunk:
195
  # f.write(chunk)
196
+ return "Success", response
197
 
198
  def microsoft(text, name, style="Neural"):
199
  """
 
220
  headers=headers,
221
  data=data,
222
  )
223
+ # breakpoint()
224
  return "Success", response.content
225
 
226
  if __name__ == '__main__':
 
264
  tts_submit.click(openai, [tts_input1, tts_input2],
265
  [tts_output1, tts_output2])
266
 
267
+ app.queue(max_size=10)
268
  app.launch(share=True)
269
+ # _, audio = microsoft(all_example,microsoft_model_list[0])
270
  # print(audio)
271
  # with open("test99.mp3", "wb") as f:
272
  # f.write(audio.content)