|
|
@ -201,7 +201,8 @@ async def generate_image(input_prompt: str, negative_prompt: str, api_url: str, |
|
|
|
if r.status_code == 200: |
|
|
|
status = r_json["status"] |
|
|
|
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"] |
|
|
|
TIMEOUT = 360 |
|
|
|
DELAY = 5 |
|
|
@ -220,7 +221,8 @@ async def generate_image(input_prompt: str, negative_prompt: str, api_url: str, |
|
|
|
output = r_json["output"] |
|
|
|
break |
|
|
|
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: |
|
|
|
raise ValueError(f"<ERROR>") |
|
|
@ -264,7 +266,7 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str) |
|
|
|
} |
|
|
|
|
|
|
|
# Define your inputs |
|
|
|
payload.update({"api_endpoint": cmd}) |
|
|
|
#payload.update({"api_endpoint": cmd}) |
|
|
|
input_data = { |
|
|
|
"input": payload, |
|
|
|
"cmd": cmd, |
|
|
@ -280,7 +282,8 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str) |
|
|
|
if r.status_code == 200: |
|
|
|
status = r_json["status"] |
|
|
|
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"] |
|
|
|
TIMEOUT = 360 |
|
|
|
DELAY = 5 |
|
|
@ -299,7 +302,8 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str) |
|
|
|
output = r_json["output"] |
|
|
|
break |
|
|
|
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: |
|
|
|
raise ValueError(f"<ERROR> {status}") |
|
|
|