Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
97dd22d
1
Parent(s):
1f91102
better sentry error logging
Browse files
app.py
CHANGED
@@ -871,6 +871,31 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
871 |
if out_png is None:
|
872 |
log_output += "\nWarning: final_model.png not found in output."
|
873 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
874 |
yield (
|
875 |
log_output, # progress_output
|
876 |
out_png, # final_image_preview (same as before)
|
|
|
871 |
if out_png is None:
|
872 |
log_output += "\nWarning: final_model.png not found in output."
|
873 |
|
874 |
+
if os.path.exists(script_input_image_path):
|
875 |
+
sentry_sdk.add_attachment(
|
876 |
+
path=script_input_image_path, # file on disk
|
877 |
+
filename="input_image.png", # how it shows up in Sentry
|
878 |
+
content_type="image/png",
|
879 |
+
)
|
880 |
+
if out_png:
|
881 |
+
try:
|
882 |
+
sentry_sdk.add_attachment(
|
883 |
+
path=out_png, # file on disk
|
884 |
+
filename="final_image.png", # how it shows up in Sentry
|
885 |
+
content_type="image/png",
|
886 |
+
)
|
887 |
+
except Exception as e: # unreadable or too large
|
888 |
+
capture_exception(e)
|
889 |
+
|
890 |
+
sentry_sdk.capture_event( # moved inside the same scope
|
891 |
+
{
|
892 |
+
"message": "Autoforge process finished",
|
893 |
+
"level": "info",
|
894 |
+
"fingerprint": ["autoforge-process-finished"],
|
895 |
+
"extra": {"log": log_str},
|
896 |
+
}
|
897 |
+
)
|
898 |
+
|
899 |
yield (
|
900 |
log_output, # progress_output
|
901 |
out_png, # final_image_preview (same as before)
|