Spaces:
Running on Zero
Running on Zero
Monkey-patch gradio_client.get_type to accept bool schemas (real fix for api_info crash)
Browse files
app.py
CHANGED
|
@@ -3,6 +3,17 @@ import gc
|
|
| 3 |
import subprocess
|
| 4 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
import spaces
|
| 7 |
import gradio as gr
|
| 8 |
import torch
|
|
|
|
| 3 |
import subprocess
|
| 4 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 5 |
|
| 6 |
+
# Workaround for gradio_client get_type crash on bool additionalProperties.
|
| 7 |
+
# Must run BEFORE `import gradio as gr` so the patched function is what gradio's
|
| 8 |
+
# Blocks.get_api_info ultimately calls.
|
| 9 |
+
import gradio_client.utils as _gcu
|
| 10 |
+
_orig_get_type = _gcu.get_type
|
| 11 |
+
def _safe_get_type(schema):
|
| 12 |
+
if isinstance(schema, bool):
|
| 13 |
+
return "any"
|
| 14 |
+
return _orig_get_type(schema)
|
| 15 |
+
_gcu.get_type = _safe_get_type
|
| 16 |
+
|
| 17 |
import spaces
|
| 18 |
import gradio as gr
|
| 19 |
import torch
|