Bharat-Tiny-LLM / patch_gradio_client.py
GautamKishore's picture
Python 3.12 + gradio_client regex patch
1772eba verified
Raw
History Blame Contribute Delete
439 Bytes
import sys, re
path = "/usr/local/lib/python3.12/site-packages/gradio_client/utils.py"
with open(path) as f:
c = f.read()
# Replace all bare 'in schema' checks with dict-guarded versions in both functions
c = re.sub(
r'if "(\w+)" in schema:',
r'if isinstance(schema, dict) and "\1" in schema:',
c
)
with open(path, "w") as f:
f.write(c)
print("Patched all schema dict checks in gradio_client/utils.py")
sys.exit(0)