Pendrokar commited on
Commit
22b65d9
β€’
1 Parent(s): f4f5edf

autoplay; increase Web Request verbosity

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -144,6 +144,7 @@ def load_model(voice_model_name):
144
 
145
  embs = base_speaker_emb
146
 
 
147
  try:
148
  response = requests.post('http://0.0.0.0:8008/loadModel', json=data, timeout=60)
149
  response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
@@ -153,7 +154,7 @@ def load_model(voice_model_name):
153
  voice_model_json = json.load(f)
154
  embs = voice_model_json['games'][0]['base_speaker_emb']
155
  except requests.exceptions.RequestException as err:
156
- print('Failed to load voice model!')
157
 
158
  return embs
159
 
@@ -214,7 +215,7 @@ def predict(
214
  response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
215
  json_data = json.loads(response.text)
216
  except requests.exceptions.RequestException as err:
217
- print('Failed to synthesize!')
218
  save_path = ''
219
  response = {'text': '{"message": "Failed"}'}
220
  json_data = {
@@ -390,7 +391,12 @@ with gr.Blocks(css=".arpabet {display: inline-block; background-color: gray; bor
390
 
391
  with gr.Row(): # Main row for inputs and language selection
392
  with gr.Column(): # Input column
393
- output_wav = gr.Audio(label="22kHz audio output", type="filepath", editable=False)
 
 
 
 
 
394
  with gr.Column(): # Input column
395
  output_arpabet = gr.HTML(label="ARPAbet")
396
 
 
144
 
145
  embs = base_speaker_emb
146
 
147
+ print('Loading voice model...')
148
  try:
149
  response = requests.post('http://0.0.0.0:8008/loadModel', json=data, timeout=60)
150
  response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
 
154
  voice_model_json = json.load(f)
155
  embs = voice_model_json['games'][0]['base_speaker_emb']
156
  except requests.exceptions.RequestException as err:
157
+ print(f'FAILED to load voice model: {err}')
158
 
159
  return embs
160
 
 
215
  response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
216
  json_data = json.loads(response.text)
217
  except requests.exceptions.RequestException as err:
218
+ print('FAILED to synthesize: {err}')
219
  save_path = ''
220
  response = {'text': '{"message": "Failed"}'}
221
  json_data = {
 
391
 
392
  with gr.Row(): # Main row for inputs and language selection
393
  with gr.Column(): # Input column
394
+ output_wav = gr.Audio(
395
+ label="22kHz audio output",
396
+ type="filepath",
397
+ editable=False,
398
+ autoplay=True
399
+ )
400
  with gr.Column(): # Input column
401
  output_arpabet = gr.HTML(label="ARPAbet")
402