update patch
Browse files- app.py +1 -18
- patch_gradio.py +2 -4
app.py
CHANGED
|
@@ -2,24 +2,7 @@
|
|
| 2 |
try:
|
| 3 |
from patch_gradio import patched_get_type
|
| 4 |
except ImportError:
|
| 5 |
-
|
| 6 |
-
from types import MethodType
|
| 7 |
-
import gradio_client.utils
|
| 8 |
-
|
| 9 |
-
# Store the original function
|
| 10 |
-
original_get_type = gradio_client.utils.get_type
|
| 11 |
-
|
| 12 |
-
# Define the patched function
|
| 13 |
-
def patched_get_type(schema):
|
| 14 |
-
# Check if schema is a dict before using 'in' operator
|
| 15 |
-
if not isinstance(schema, dict):
|
| 16 |
-
return str(schema) # Convert to string as fallback
|
| 17 |
-
|
| 18 |
-
# Original logic continues
|
| 19 |
-
return original_get_type(schema)
|
| 20 |
-
|
| 21 |
-
# Apply the patch
|
| 22 |
-
gradio_client.utils.get_type = patched_get_type
|
| 23 |
|
| 24 |
# Now import the rest of the packages
|
| 25 |
import gradio as gr
|
|
|
|
| 2 |
try:
|
| 3 |
from patch_gradio import patched_get_type
|
| 4 |
except ImportError:
|
| 5 |
+
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Now import the rest of the packages
|
| 8 |
import gradio as gr
|
patch_gradio.py
CHANGED
|
@@ -1,18 +1,16 @@
|
|
| 1 |
-
# Create a file called patch_gradio.py
|
| 2 |
-
from types import MethodType
|
| 3 |
import gradio_client.utils
|
| 4 |
|
| 5 |
# Store the original function
|
| 6 |
original_get_type = gradio_client.utils.get_type
|
| 7 |
|
| 8 |
# Define the patched function
|
| 9 |
-
def patched_get_type(
|
| 10 |
# Check if schema is a dict before using 'in' operator
|
| 11 |
if not isinstance(schema, dict):
|
| 12 |
return str(schema) # Convert to string as fallback
|
| 13 |
|
| 14 |
# Original logic continues
|
| 15 |
-
return original_get_type(
|
| 16 |
|
| 17 |
# Apply the patch
|
| 18 |
gradio_client.utils.get_type = patched_get_type
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio_client.utils
|
| 2 |
|
| 3 |
# Store the original function
|
| 4 |
original_get_type = gradio_client.utils.get_type
|
| 5 |
|
| 6 |
# Define the patched function
|
| 7 |
+
def patched_get_type(schema):
|
| 8 |
# Check if schema is a dict before using 'in' operator
|
| 9 |
if not isinstance(schema, dict):
|
| 10 |
return str(schema) # Convert to string as fallback
|
| 11 |
|
| 12 |
# Original logic continues
|
| 13 |
+
return original_get_type(schema)
|
| 14 |
|
| 15 |
# Apply the patch
|
| 16 |
gradio_client.utils.get_type = patched_get_type
|