Spaces:
Running on Zero
Running on Zero
Manmay Nakhashi commited on
Commit ·
96dc22c
1
Parent(s): 459924b
Pin pydantic==2.10.6 to fix gradio_client schema bool TypeError
Browse filesPer HF forum (discuss.huggingface.co/t/154601), newer pydantic emits
'additionalProperties: True' schemas that gradio 4.44.1's bundled
gradio_client 1.3.0 crashes on. Pinning pydantic to the last
gradio-compatible release fixes it at the source. Removing the
in-app monkey patch since the upstream pin is enough.
- app.py +2 -26
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -11,32 +11,8 @@ import sys
|
|
| 11 |
import tempfile
|
| 12 |
import time
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
# Patching has to happen BEFORE `import gradio` triggers the schema walk on launch.
|
| 17 |
-
import gradio_client.utils as _gcu # noqa: E402
|
| 18 |
-
|
| 19 |
-
_orig_get_type = _gcu.get_type
|
| 20 |
-
_orig_json_to_py = _gcu._json_schema_to_python_type
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
def _safe_get_type(schema):
|
| 24 |
-
if not isinstance(schema, dict):
|
| 25 |
-
return "Any"
|
| 26 |
-
return _orig_get_type(schema)
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
def _safe_json_to_py(schema, defs=None):
|
| 30 |
-
if not isinstance(schema, dict):
|
| 31 |
-
return "Any"
|
| 32 |
-
return _orig_json_to_py(schema, defs)
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
_gcu.get_type = _safe_get_type
|
| 36 |
-
_gcu._json_schema_to_python_type = _safe_json_to_py
|
| 37 |
-
|
| 38 |
-
import gradio as gr # noqa: E402
|
| 39 |
-
import spaces # noqa: E402
|
| 40 |
|
| 41 |
# Local src import.
|
| 42 |
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "src"))
|
|
|
|
| 11 |
import tempfile
|
| 12 |
import time
|
| 13 |
|
| 14 |
+
import gradio as gr
|
| 15 |
+
import spaces
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Local src import.
|
| 18 |
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "src"))
|
requirements.txt
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
torch==2.4.0
|
| 2 |
torchaudio==2.4.0
|
|
|
|
| 3 |
safetensors>=0.4.0
|
| 4 |
accelerate>=0.25.0
|
| 5 |
peft>=0.7.0
|
|
|
|
| 1 |
torch==2.4.0
|
| 2 |
torchaudio==2.4.0
|
| 3 |
+
pydantic==2.10.6
|
| 4 |
safetensors>=0.4.0
|
| 5 |
accelerate>=0.25.0
|
| 6 |
peft>=0.7.0
|