Browse Source

error messages

master
Hendrik Langer 2 years ago
parent
commit
74282a3fbb
  1. 14
      matrix_pygmalion_bot/ai/runpod_pygmalion.py

14
matrix_pygmalion_bot/ai/runpod_pygmalion.py

@ -201,7 +201,8 @@ async def generate_image(input_prompt: str, negative_prompt: str, api_url: str,
if r.status_code == 200: if r.status_code == 200:
status = r_json["status"] status = r_json["status"]
if status != 'IN_QUEUE': if status != 'IN_QUEUE':
raise ValueError(f"RETURN CODE {status}") err_msg = r_json["error"] if "error" in r_json else ""
raise ValueError(f"RETURN CODE {status}: {err_msg}")
job_id = r_json["id"] job_id = r_json["id"]
TIMEOUT = 360 TIMEOUT = 360
DELAY = 5 DELAY = 5
@ -220,7 +221,8 @@ async def generate_image(input_prompt: str, negative_prompt: str, api_url: str,
output = r_json["output"] output = r_json["output"]
break break
else: else:
raise ValueError(f"RETURN CODE {status}") err_msg = r_json["error"] if "error" in r_json else ""
raise ValueError(f"RETURN CODE {status}: {err_msg}")
if not output: if not output:
raise ValueError(f"<ERROR>") raise ValueError(f"<ERROR>")
@ -264,7 +266,7 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str)
} }
# Define your inputs # Define your inputs
payload.update({"api_endpoint": cmd}) #payload.update({"api_endpoint": cmd})
input_data = { input_data = {
"input": payload, "input": payload,
"cmd": cmd, "cmd": cmd,
@ -280,7 +282,8 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str)
if r.status_code == 200: if r.status_code == 200:
status = r_json["status"] status = r_json["status"]
if status != 'IN_QUEUE': if status != 'IN_QUEUE':
raise ValueError(f"RETURN CODE {status}") err_msg = r_json["error"] if "error" in r_json else ""
raise ValueError(f"RETURN CODE {status}: {err_msg}")
job_id = r_json["id"] job_id = r_json["id"]
TIMEOUT = 360 TIMEOUT = 360
DELAY = 5 DELAY = 5
@ -299,7 +302,8 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str)
output = r_json["output"] output = r_json["output"]
break break
else: else:
raise ValueError(f"RETURN CODE {status}") err_msg = r_json["error"] if "error" in r_json else ""
raise ValueError(f"RETURN CODE {status}: {err_msg}")
if not output: if not output:
raise ValueError(f"<ERROR> {status}") raise ValueError(f"<ERROR> {status}")

Loading…
Cancel
Save