Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
catch web exceptions
Browse files
app.py
CHANGED
@@ -26,8 +26,12 @@ def run_xvaserver():
|
|
26 |
|
27 |
# contact local xVASynth server; ~2 second timeout
|
28 |
print('Attempting to connect to xVASynth...')
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
31 |
|
32 |
print('xVAServer running on port 8008')
|
33 |
|
@@ -93,8 +97,12 @@ def predict(input, pacing):
|
|
93 |
'useSR': use_sr,
|
94 |
'useCleanup': use_cleanup,
|
95 |
}
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
|
99 |
print('server.log contents:')
|
100 |
with open('server.log', 'r') as f:
|
|
|
26 |
|
27 |
# contact local xVASynth server; ~2 second timeout
|
28 |
print('Attempting to connect to xVASynth...')
|
29 |
+
try:
|
30 |
+
response = requests.get('http://0.0.0.0:8008')
|
31 |
+
response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
|
32 |
+
except requests.exceptions.RequestException as err:
|
33 |
+
print('Failed to connect!')
|
34 |
+
return
|
35 |
|
36 |
print('xVAServer running on port 8008')
|
37 |
|
|
|
97 |
'useSR': use_sr,
|
98 |
'useCleanup': use_cleanup,
|
99 |
}
|
100 |
+
|
101 |
+
try:
|
102 |
+
response = requests.post('http://0.0.0.0:8008/synthesize', json=data)
|
103 |
+
response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
|
104 |
+
except requests.exceptions.RequestException as err:
|
105 |
+
print('Failed to synthesize!')
|
106 |
|
107 |
print('server.log contents:')
|
108 |
with open('server.log', 'r') as f:
|