Abid Ali Awan Codex commited on
Commit ·
7cfef5a
1
Parent(s): 4149e50
Make image upload guidance wrapper-independent
Browse filesMap image-only generation failures to the notice upload warning without relying on exception text hidden by the ZeroGPU wrapper.
Co-authored-by: Codex <codex@openai.com>
- app/service.py +1 -5
- tests/test_tracing.py +1 -3
app/service.py
CHANGED
|
@@ -204,11 +204,7 @@ def analyze_notice(
|
|
| 204 |
if "ZeroGPU quota" in exc_text or "exceeded your ZeroGPU" in exc_text:
|
| 205 |
message = "GPU quota exceeded. Please try again later or authenticate with a Hugging Face token for more quota."
|
| 206 |
error_code = "gpuQuotaError"
|
| 207 |
-
elif
|
| 208 |
-
image_data_url
|
| 209 |
-
and not text
|
| 210 |
-
and "invalid response" in exc_text.lower()
|
| 211 |
-
):
|
| 212 |
return notice_image_warning(status)
|
| 213 |
else:
|
| 214 |
message = "The local model returned an invalid response. Please try again."
|
|
|
|
| 204 |
if "ZeroGPU quota" in exc_text or "exceeded your ZeroGPU" in exc_text:
|
| 205 |
message = "GPU quota exceeded. Please try again later or authenticate with a Hugging Face token for more quota."
|
| 206 |
error_code = "gpuQuotaError"
|
| 207 |
+
elif image_data_url and not text:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
return notice_image_warning(status)
|
| 209 |
else:
|
| 210 |
message = "The local model returned an invalid response. Please try again."
|
tests/test_tracing.py
CHANGED
|
@@ -426,9 +426,7 @@ class TraceTests(unittest.TestCase):
|
|
| 426 |
return_value={"connected": True, "label": "ready"},
|
| 427 |
), patch(
|
| 428 |
"app.model_endpoint.call_model",
|
| 429 |
-
side_effect=RuntimeError(
|
| 430 |
-
"The local model returned an invalid response."
|
| 431 |
-
),
|
| 432 |
):
|
| 433 |
result = app.analyze_notice(
|
| 434 |
image_data_url="data:image/png;base64,AAAA",
|
|
|
|
| 426 |
return_value={"connected": True, "label": "ready"},
|
| 427 |
), patch(
|
| 428 |
"app.model_endpoint.call_model",
|
| 429 |
+
side_effect=RuntimeError("sanitized ZeroGPU worker failure"),
|
|
|
|
|
|
|
| 430 |
):
|
| 431 |
result = app.analyze_notice(
|
| 432 |
image_data_url="data:image/png;base64,AAAA",
|