Spaces:
Sleeping
Sleeping
Commit ·
9d8cafd
1
Parent(s): 1cafac3
requirmeents update
Browse files
app.py
CHANGED
|
@@ -11,6 +11,21 @@ free Space degrades into a wait rather than a flurry of 429s.
|
|
| 11 |
import sys
|
| 12 |
print("!!! APP IS STARTING !!!", file=sys.stderr)
|
| 13 |
sys.stderr.flush()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
import os
|
| 15 |
import tempfile
|
| 16 |
import zipfile
|
|
@@ -172,4 +187,4 @@ if __name__ == "__main__":
|
|
| 172 |
# running app (the default 127.0.0.1 bind can leave a Space stuck "Starting").
|
| 173 |
port = int(os.environ.get("GRADIO_SERVER_PORT", os.environ.get("PORT", 7860)))
|
| 174 |
_log(f"launching gradio on 0.0.0.0:{port} ...")
|
| 175 |
-
demo.launch(server_name="0.0.0.0", server_port=port)
|
|
|
|
| 11 |
import sys
|
| 12 |
print("!!! APP IS STARTING !!!", file=sys.stderr)
|
| 13 |
sys.stderr.flush()
|
| 14 |
+
|
| 15 |
+
# --- MONKEY PATCH GRADIO CLIENT BUG ---
|
| 16 |
+
try:
|
| 17 |
+
import gradio_client.utils as client_utils
|
| 18 |
+
orig_get_type = client_utils.get_type
|
| 19 |
+
def patched_get_type(schema):
|
| 20 |
+
if isinstance(schema, bool):
|
| 21 |
+
return "boolean"
|
| 22 |
+
return orig_get_type(schema)
|
| 23 |
+
client_utils.get_type = patched_get_type
|
| 24 |
+
print("[app] Applied monkey-patch to gradio_client.utils.get_type", flush=True)
|
| 25 |
+
except Exception as e:
|
| 26 |
+
print(f"[app] Failed to apply monkey-patch: {e}", flush=True)
|
| 27 |
+
# --------------------------------------
|
| 28 |
+
|
| 29 |
import os
|
| 30 |
import tempfile
|
| 31 |
import zipfile
|
|
|
|
| 187 |
# running app (the default 127.0.0.1 bind can leave a Space stuck "Starting").
|
| 188 |
port = int(os.environ.get("GRADIO_SERVER_PORT", os.environ.get("PORT", 7860)))
|
| 189 |
_log(f"launching gradio on 0.0.0.0:{port} ...")
|
| 190 |
+
demo.launch(server_name="0.0.0.0", server_port=port)
|