Spaces:
Running
Running
sara.mesquita commited on
Commit ·
2af65c2
1
Parent(s): d9a3495
fix: use script file to patch gradio_client (Dockerfile multiline issue)
Browse files- Dockerfile +3 -13
- patch_gradio.py +12 -0
Dockerfile
CHANGED
|
@@ -9,19 +9,9 @@ RUN apt-get update && apt-get install -y \
|
|
| 9 |
COPY requirements.txt .
|
| 10 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
with open(path) as f:
|
| 16 |
-
src = f.read()
|
| 17 |
-
src = src.replace(
|
| 18 |
-
'def get_type(schema):\n',
|
| 19 |
-
'def get_type(schema):\n if not isinstance(schema, dict): return \"Any\"\n'
|
| 20 |
-
)
|
| 21 |
-
with open(path, 'w') as f:
|
| 22 |
-
f.write(src)
|
| 23 |
-
print('gradio_client patched OK')
|
| 24 |
-
"
|
| 25 |
|
| 26 |
COPY . .
|
| 27 |
|
|
|
|
| 9 |
COPY requirements.txt .
|
| 10 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
|
| 12 |
+
COPY patch_gradio.py .
|
| 13 |
+
# Fix bug gradio_client 1.3.0: get_type() não trata schema=bool
|
| 14 |
+
RUN python3 patch_gradio.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
COPY . .
|
| 17 |
|
patch_gradio.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Patch gradio_client get_type() to handle bool schemas (additionalProperties: false)."""
|
| 2 |
+
path = "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py"
|
| 3 |
+
with open(path) as f:
|
| 4 |
+
src = f.read()
|
| 5 |
+
patched = src.replace(
|
| 6 |
+
"def get_type(schema):\n",
|
| 7 |
+
'def get_type(schema):\n if not isinstance(schema, dict): return "Any"\n',
|
| 8 |
+
)
|
| 9 |
+
assert patched != src, "Pattern not found — patch failed"
|
| 10 |
+
with open(path, "w") as f:
|
| 11 |
+
f.write(patched)
|
| 12 |
+
print("gradio_client patched OK")
|