Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
gradio predict fix
Browse files
app.py
CHANGED
|
@@ -212,14 +212,15 @@ def predict(
|
|
| 212 |
try:
|
| 213 |
response = requests.post('http://0.0.0.0:8008/synthesize', json=data, timeout=60)
|
| 214 |
response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
|
| 215 |
-
|
| 216 |
except requests.exceptions.RequestException as err:
|
| 217 |
print('Failed to synthesize!')
|
| 218 |
save_path = ''
|
| 219 |
-
|
| 220 |
|
| 221 |
-
|
| 222 |
-
|
|
|
|
| 223 |
|
| 224 |
arpabet_html = '<h6>ARPAbet & Durations</h6>'
|
| 225 |
arpabet_symbols = json_data['arpabet'].split('|')
|
|
@@ -233,12 +234,8 @@ def predict(
|
|
| 233 |
+ arpabet_symbols[symb_i]\
|
| 234 |
+ '</strong> '
|
| 235 |
|
| 236 |
-
print('server.log contents:')
|
| 237 |
-
with open('resources/app/server.log', 'r') as f:
|
| 238 |
-
print(f.read())
|
| 239 |
-
|
| 240 |
return [
|
| 241 |
-
|
| 242 |
arpabet_html,
|
| 243 |
round(json_data['em_angry'][0], 2),
|
| 244 |
round(json_data['em_happy'][0], 2),
|
|
|
|
| 212 |
try:
|
| 213 |
response = requests.post('http://0.0.0.0:8008/synthesize', json=data, timeout=60)
|
| 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 |
+
json_data = {text: 'Failed'}
|
| 220 |
|
| 221 |
+
print('server.log contents:')
|
| 222 |
+
with open('resources/app/server.log', 'r') as f:
|
| 223 |
+
print(f.read())
|
| 224 |
|
| 225 |
arpabet_html = '<h6>ARPAbet & Durations</h6>'
|
| 226 |
arpabet_symbols = json_data['arpabet'].split('|')
|
|
|
|
| 234 |
+ arpabet_symbols[symb_i]\
|
| 235 |
+ '</strong> '
|
| 236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
return [
|
| 238 |
+
save_path,
|
| 239 |
arpabet_html,
|
| 240 |
round(json_data['em_angry'][0], 2),
|
| 241 |
round(json_data['em_happy'][0], 2),
|