|
|
@ -95,8 +95,8 @@ async def generate_sync( |
|
|
|
else: |
|
|
|
err_msg = r_json["error"] if "error" in r_json else "" |
|
|
|
err_msg = err_msg.replace("\\n", "\n") |
|
|
|
raise ValueError(f"RETURN CODE {status}: {err_msg}") |
|
|
|
raise ValueError(f"<TIMEOUT>") |
|
|
|
raise ValueError(f"<ERROR> RETURN CODE {status}: {err_msg}") |
|
|
|
raise ValueError(f"<ERROR> TIMEOUT") |
|
|
|
else: |
|
|
|
raise ValueError(f"<ERROR>") |
|
|
|
|
|
|
@ -137,7 +137,7 @@ async def generate_image(input_prompt: str, negative_prompt: str, api_url: str, |
|
|
|
try: |
|
|
|
r = requests.post(endpoint, json=input_data, headers=headers) |
|
|
|
except requests.exceptions.RequestException as e: |
|
|
|
raise ValueError(f"<HTTP ERROR>") |
|
|
|
raise ValueError(f"<ERROR> HTTP ERROR") |
|
|
|
r_json = r.json() |
|
|
|
logger.debug(r_json) |
|
|
|
|
|
|
@ -145,7 +145,7 @@ async def generate_image(input_prompt: str, negative_prompt: str, api_url: str, |
|
|
|
status = r_json["status"] |
|
|
|
if status != 'IN_QUEUE': |
|
|
|
err_msg = r_json["error"] if "error" in r_json else "" |
|
|
|
raise ValueError(f"RETURN CODE {status}: {err_msg}") |
|
|
|
raise ValueError(f"<ERROR> RETURN CODE {status}: {err_msg}") |
|
|
|
job_id = r_json["id"] |
|
|
|
TIMEOUT = 360 |
|
|
|
DELAY = 5 |
|
|
@ -167,7 +167,7 @@ async def generate_image(input_prompt: str, negative_prompt: str, api_url: str, |
|
|
|
else: |
|
|
|
err_msg = r_json["error"] if "error" in r_json else "" |
|
|
|
err_msg = err_msg.replace("\\n", "\n") |
|
|
|
raise ValueError(f"RETURN CODE {status}: {err_msg}") |
|
|
|
raise ValueError(f"<ERROR> RETURN CODE {status}: {err_msg}") |
|
|
|
|
|
|
|
if not output: |
|
|
|
raise ValueError(f"<ERROR>") |
|
|
@ -238,7 +238,7 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str, |
|
|
|
try: |
|
|
|
r = requests.post(endpoint, json=input_data, headers=headers) |
|
|
|
except requests.exceptions.RequestException as e: |
|
|
|
raise ValueError(f"<HTTP ERROR>") |
|
|
|
raise ValueError(f"<ERROR> HTTP ERROR") |
|
|
|
r_json = r.json() |
|
|
|
logger.debug(r_json) |
|
|
|
|
|
|
@ -246,7 +246,7 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str, |
|
|
|
status = r_json["status"] |
|
|
|
if status != 'IN_QUEUE': |
|
|
|
err_msg = r_json["error"] if "error" in r_json else "" |
|
|
|
raise ValueError(f"RETURN CODE {status}: {err_msg}") |
|
|
|
raise ValueError(f"<ERROR> RETURN CODE {status}: {err_msg}") |
|
|
|
job_id = r_json["id"] |
|
|
|
TIMEOUT = 360 |
|
|
|
DELAY = 5 |
|
|
@ -267,7 +267,7 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str, |
|
|
|
break |
|
|
|
else: |
|
|
|
err_msg = r_json["error"] if "error" in r_json else "" |
|
|
|
raise ValueError(f"RETURN CODE {status}: {err_msg}") |
|
|
|
raise ValueError(f"<ERROR> RETURN CODE {status}: {err_msg}") |
|
|
|
|
|
|
|
if not output: |
|
|
|
raise ValueError(f"<ERROR> {status}") |
|
|
|