Spaces:
Sleeping
Sleeping
vitor.fran commited on
Commit ·
953111b
1
Parent(s): a8ce441
debug: add traceback visualizer on error
Browse files
app.py
CHANGED
|
@@ -33,11 +33,19 @@ def process_faceless(input_image, prompt="", negative_prompt=""):
|
|
| 33 |
else:
|
| 34 |
return lineart_path, None
|
| 35 |
except Exception as e:
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
# Interface Gradio
|
| 43 |
demo = gr.Interface(
|
|
|
|
| 33 |
else:
|
| 34 |
return lineart_path, None
|
| 35 |
except Exception as e:
|
| 36 |
+
import traceback
|
| 37 |
+
err_str = "".join(traceback.format_exception(type(e), e, e.__traceback__))
|
| 38 |
+
print(f"[ERRO] process_faceless: {err_str}")
|
| 39 |
+
|
| 40 |
+
from PIL import ImageDraw
|
| 41 |
+
err_img = Image.new("RGBA", (1024, 1024), (40, 0, 0, 255))
|
| 42 |
+
draw = ImageDraw.Draw(err_img)
|
| 43 |
+
draw.text((10, 10), err_str, fill=(255, 255, 255, 255))
|
| 44 |
+
|
| 45 |
+
err_path = os.path.join(tempfile.gettempdir(), f"err_{os.getpid()}_{os.urandom(4).hex()}.png")
|
| 46 |
+
err_img.save(err_path, "PNG")
|
| 47 |
+
return err_path, None
|
| 48 |
+
|
| 49 |
|
| 50 |
# Interface Gradio
|
| 51 |
demo = gr.Interface(
|