Pendrokar commited on
Commit
63b454b
β€’
1 Parent(s): 37132c3

raise status on synthesize

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -31,6 +31,9 @@ def run_xvaserver():
31
 
32
  print('xVAServer running on port 8008')
33
 
 
 
 
34
  # Read and print stdout and stderr of the subprocess
35
  while True:
36
  output = xvaserver.stdout.readline()
@@ -60,7 +63,8 @@ def load_model():
60
  'base_lang': language,
61
  'pluginsContext': '{}',
62
  }
63
- requests.post('http://0.0.0.0:8008/loadModel', json=data)
 
64
  return
65
 
66
  def predict(input, pacing):
@@ -84,7 +88,8 @@ def predict(input, pacing):
84
  'useSR': use_sr,
85
  'useCleanup': use_cleanup,
86
  }
87
- requests.post('http://0.0.0.0:8008/synthesize', json=data)
 
88
  return 22100, os.open(save_path, "rb")
89
 
90
  input_textbox = gr.Textbox(
@@ -101,15 +106,17 @@ gradio_app = gr.Interface(
101
  slider
102
  ],
103
  outputs= "audio",
104
- title="xVASynth",
105
  )
106
 
107
 
108
  if __name__ == "__main__":
109
  # Run the web server in a separate thread
110
  web_server_thread = threading.Thread(target=run_xvaserver)
 
111
  web_server_thread.start()
112
 
 
113
  gradio_app.launch()
114
 
115
  # Wait for the web server thread to finish (shouldn't be reached in normal execution)
 
31
 
32
  print('xVAServer running on port 8008')
33
 
34
+ # load default voice model
35
+ # load_model()
36
+
37
  # Read and print stdout and stderr of the subprocess
38
  while True:
39
  output = xvaserver.stdout.readline()
 
63
  'base_lang': language,
64
  'pluginsContext': '{}',
65
  }
66
+ response = requests.post('http://0.0.0.0:8008/loadModel', json=data)
67
+ response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
68
  return
69
 
70
  def predict(input, pacing):
 
88
  'useSR': use_sr,
89
  'useCleanup': use_cleanup,
90
  }
91
+ response = requests.post('http://0.0.0.0:8008/synthesize', json=data)
92
+ response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
93
  return 22100, os.open(save_path, "rb")
94
 
95
  input_textbox = gr.Textbox(
 
106
  slider
107
  ],
108
  outputs= "audio",
109
+ title="xVASynth (WIP)",
110
  )
111
 
112
 
113
  if __name__ == "__main__":
114
  # Run the web server in a separate thread
115
  web_server_thread = threading.Thread(target=run_xvaserver)
116
+ print('Starting xVAServer thread')
117
  web_server_thread.start()
118
 
119
+ print('running Gradio interface')
120
  gradio_app.launch()
121
 
122
  # Wait for the web server thread to finish (shouldn't be reached in normal execution)