Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
8513b12
1
Parent(s):
54810a9
fix monkey patch
Browse files
app.py
CHANGED
@@ -36,20 +36,19 @@ sentry_sdk.capture_message("🎉 Sentry is wired up!")
|
|
36 |
import gradio, functools
|
37 |
from sentry_sdk import capture_exception, flush
|
38 |
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
gradio.utils.run_sync = sentry_run_sync # global patch
|
53 |
|
54 |
|
55 |
import gradio as gr
|
|
|
36 |
import gradio, functools
|
37 |
from sentry_sdk import capture_exception, flush
|
38 |
|
39 |
+
orig_call_fn = gradio.blocks.Blocks.call_function # present in all 3.x & 4.x
|
40 |
|
41 |
+
@functools.wraps(orig_call_fn)
|
42 |
+
async def sentry_call_fn(self, *args, **kwargs):
|
43 |
+
try:
|
44 |
+
return await orig_call_fn(self, *args, **kwargs)
|
45 |
+
except Exception as exc:
|
46 |
+
capture_exception(exc)
|
47 |
+
flush(timeout=2)
|
48 |
+
raise
|
49 |
+
|
50 |
+
gradio.blocks.Blocks.call_function = sentry_call_fn
|
51 |
|
|
|
52 |
|
53 |
|
54 |
import gradio as gr
|