Mira1sen commited on
Commit
8826dde
1 Parent(s): e80b05f

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. tts_gradio.py +11 -10
tts_gradio.py CHANGED
@@ -156,8 +156,8 @@ def openai(text, name):
156
 
157
  json_data = {
158
  'model': 'tts-1-hd',
159
- 'input': f'{text}',
160
- 'voice': f'{name}',
161
  }
162
 
163
  response = requests.post('https://api.openai.com/v1/audio/speech', headers=headers, json=json_data)
@@ -181,7 +181,7 @@ def elevenlabs(text,name):
181
  }
182
 
183
  data = {
184
- "text": f"{text}",
185
  "model_id": "eleven_monolingual_v1",
186
  "voice_settings": {
187
  "stability": 0.5,
@@ -216,12 +216,12 @@ def microsoft(text, name, style="Neural"):
216
  "</voice>"
217
  "</speak>")
218
 
219
- response = requests.post(
220
- 'https://japaneast.tts.speech.microsoft.com/cognitiveservices/v1',
221
- headers=headers,
222
- data=data,
223
- )
224
- return "Success", response
225
 
226
  if __name__ == '__main__':
227
  parser = argparse.ArgumentParser()
@@ -250,7 +250,8 @@ if __name__ == '__main__':
250
  tts_input2 = gr.Dropdown(microsoft_model_list, label="name")
251
  tts_submit = gr.Button("Generate", variant="primary")
252
  tts_output1 = gr.Textbox(label="Output Message")
253
- tts_output2 = gr.Audio(label="Output Audio")
 
254
  tts_submit.click(microsoft, [tts_input1, tts_input2],
255
  [tts_output1, tts_output2])
256
 
 
156
 
157
  json_data = {
158
  'model': 'tts-1-hd',
159
+ 'input': text,
160
+ 'voice': name,
161
  }
162
 
163
  response = requests.post('https://api.openai.com/v1/audio/speech', headers=headers, json=json_data)
 
181
  }
182
 
183
  data = {
184
+ "text": text,
185
  "model_id": "eleven_monolingual_v1",
186
  "voice_settings": {
187
  "stability": 0.5,
 
216
  "</voice>"
217
  "</speak>")
218
 
219
+ # response = requests.post(
220
+ # 'https://japaneast.tts.speech.microsoft.com/cognitiveservices/v1',
221
+ # headers=headers,
222
+ # data=data,
223
+ # )
224
+ return "Success", "sss"
225
 
226
  if __name__ == '__main__':
227
  parser = argparse.ArgumentParser()
 
250
  tts_input2 = gr.Dropdown(microsoft_model_list, label="name")
251
  tts_submit = gr.Button("Generate", variant="primary")
252
  tts_output1 = gr.Textbox(label="Output Message")
253
+ tts_output2 = gr.Textbox(label="Output Audio")
254
+ #tts_output2 = gr.Audio(label="Output Audio")
255
  tts_submit.click(microsoft, [tts_input1, tts_input2],
256
  [tts_output1, tts_output2])
257