Pendrokar commited on
Commit
675fe4f
β€’
1 Parent(s): a6dc01d

do not rerun xVASynth if active

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -216,7 +216,7 @@ def predict(
216
  except requests.exceptions.RequestException as err:
217
  print('Failed to synthesize!')
218
  save_path = ''
219
- json_data = {text: 'Failed'}
220
 
221
  print('server.log contents:')
222
  with open('resources/app/server.log', 'r') as f:
@@ -460,9 +460,16 @@ with gr.Blocks(css=".arpabet {display: inline-block; background-color: gray; bor
460
 
461
  if __name__ == "__main__":
462
  # Run the web server in a separate thread
463
- web_server_thread = threading.Thread(target=run_xvaserver)
464
- print('Starting xVAServer thread')
465
- web_server_thread.start()
 
 
 
 
 
 
 
466
 
467
  print('running Gradio interface')
468
  demo.launch()
 
216
  except requests.exceptions.RequestException as err:
217
  print('Failed to synthesize!')
218
  save_path = ''
219
+ json_data = {'text': 'Failed'}
220
 
221
  print('server.log contents:')
222
  with open('resources/app/server.log', 'r') as f:
 
460
 
461
  if __name__ == "__main__":
462
  # Run the web server in a separate thread
463
+
464
+ print('Attempting to connect to local xVASynth server...')
465
+ try:
466
+ response = requests.get('http://0.0.0.0:8008')
467
+ response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
468
+ except requests.exceptions.RequestException as err:
469
+ print('Failed to connect to xVASynth!')
470
+ web_server_thread = threading.Thread(target=run_xvaserver)
471
+ print('Starting xVAServer thread')
472
+ web_server_thread.start()
473
 
474
  print('running Gradio interface')
475
  demo.launch()