Pendrokar commited on
Commit
39d5768
β€’
1 Parent(s): 2256254

load jsondata from response

Browse files
Files changed (2) hide show
  1. app.py +1 -0
  2. resources/app/no_server.py +2 -1
app.py CHANGED
@@ -221,6 +221,7 @@ def predict(
221
  print('Synthesizing...')
222
  try:
223
  response = xvaserver.synthesize(data)
 
224
  # response = requests.post('http://0.0.0.0:8008/synthesize', json=data, timeout=60)
225
  # response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
226
  # json_data = json.loads(response.text)
 
221
  print('Synthesizing...')
222
  try:
223
  response = xvaserver.synthesize(data)
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)
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,6 +152,7 @@ def loadModel(post_data):
152
  return req_response
153
 
154
  def synthesize(post_data):
 
155
  logger.info("Direct: synthesize")
156
  post_data["pluginsContext"] = json.loads(post_data["pluginsContext"])
157
  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