Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
non json json_data var
Browse files- app.py +2 -5
- resources/app/no_server.py +2 -2
app.py
CHANGED
@@ -154,9 +154,7 @@ def load_model(voice_model_name):
|
|
154 |
|
155 |
print('Loading voice model...')
|
156 |
try:
|
157 |
-
|
158 |
-
# response = requests.post('http://0.0.0.0:8008/loadModel', json=data, timeout=60)
|
159 |
-
# response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
|
160 |
current_voice_model = voice_model_name
|
161 |
|
162 |
with open(model_path + '.json', 'r', encoding='utf-8') as f:
|
@@ -220,8 +218,7 @@ def predict(
|
|
220 |
|
221 |
print('Synthesizing...')
|
222 |
try:
|
223 |
-
|
224 |
-
json_data = json.loads(response)
|
225 |
# response = requests.post('http://0.0.0.0:8008/synthesize', json=data, timeout=60)
|
226 |
# response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
|
227 |
# json_data = json.loads(response.text)
|
|
|
154 |
|
155 |
print('Loading voice model...')
|
156 |
try:
|
157 |
+
json_data = xvaserver.loadModel(data)
|
|
|
|
|
158 |
current_voice_model = voice_model_name
|
159 |
|
160 |
with open(model_path + '.json', 'r', encoding='utf-8') as f:
|
|
|
218 |
|
219 |
print('Synthesizing...')
|
220 |
try:
|
221 |
+
json_data = xvaserver.synthesize(data)
|
|
|
222 |
# response = requests.post('http://0.0.0.0:8008/synthesize', json=data, timeout=60)
|
223 |
# response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
|
224 |
# json_data = json.loads(response.text)
|
resources/app/no_server.py
CHANGED
@@ -130,7 +130,7 @@ logger.info("Models ready")
|
|
130 |
|
131 |
post_data = ""
|
132 |
def loadModel(post_data):
|
133 |
-
req_response =
|
134 |
logger.info("Direct: loadModel")
|
135 |
logger.info(post_data)
|
136 |
ckpt = post_data["model"]
|
@@ -152,7 +152,7 @@ def loadModel(post_data):
|
|
152 |
return req_response
|
153 |
|
154 |
def synthesize(post_data):
|
155 |
-
req_response =
|
156 |
logger.info("Direct: synthesize")
|
157 |
post_data["pluginsContext"] = json.loads(post_data["pluginsContext"])
|
158 |
instance_index = post_data["instance_index"] if "instance_index" in post_data else 0
|
|
|
130 |
|
131 |
post_data = ""
|
132 |
def loadModel(post_data):
|
133 |
+
req_response = {}
|
134 |
logger.info("Direct: loadModel")
|
135 |
logger.info(post_data)
|
136 |
ckpt = post_data["model"]
|
|
|
152 |
return req_response
|
153 |
|
154 |
def synthesize(post_data):
|
155 |
+
req_response = {}
|
156 |
logger.info("Direct: synthesize")
|
157 |
post_data["pluginsContext"] = json.loads(post_data["pluginsContext"])
|
158 |
instance_index = post_data["instance_index"] if "instance_index" in post_data else 0
|