Spaces:
Sleeping
Sleeping
segovia commited on
Commit ·
c0de355
1
Parent(s): 860389a
asd
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import tempfile
|
|
| 6 |
from pathlib import Path
|
| 7 |
|
| 8 |
# Avoid the Node.js SSR proxy in hosted environments where it can terminate unexpectedly.
|
| 9 |
-
os.environ
|
| 10 |
|
| 11 |
import gradio as gr
|
| 12 |
|
|
@@ -124,10 +124,17 @@ demo = build_app()
|
|
| 124 |
|
| 125 |
|
| 126 |
if __name__ == "__main__":
|
| 127 |
-
launch_kwargs = {"theme": gr.themes.Soft()}
|
| 128 |
|
| 129 |
# Spaces manages networking itself; local runs keep explicit host/port.
|
| 130 |
if os.getenv("SPACE_ID"):
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
else:
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
|
| 8 |
# Avoid the Node.js SSR proxy in hosted environments where it can terminate unexpectedly.
|
| 9 |
+
os.environ["GRADIO_SSR_MODE"] = "false"
|
| 10 |
|
| 11 |
import gradio as gr
|
| 12 |
|
|
|
|
| 124 |
|
| 125 |
|
| 126 |
if __name__ == "__main__":
|
| 127 |
+
launch_kwargs = {"theme": gr.themes.Soft(), "show_error": True}
|
| 128 |
|
| 129 |
# Spaces manages networking itself; local runs keep explicit host/port.
|
| 130 |
if os.getenv("SPACE_ID"):
|
| 131 |
+
try:
|
| 132 |
+
demo.launch(ssr_mode=False, **launch_kwargs)
|
| 133 |
+
except TypeError:
|
| 134 |
+
# Backward-compatible fallback if this Gradio build does not accept ssr_mode.
|
| 135 |
+
demo.launch(**launch_kwargs)
|
| 136 |
else:
|
| 137 |
+
try:
|
| 138 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, ssr_mode=False, **launch_kwargs)
|
| 139 |
+
except TypeError:
|
| 140 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, **launch_kwargs)
|