Update app.py
Browse filesApply a Monkey Patch in Your App Code.
app.py
CHANGED
@@ -1,3 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from langdetect import detect
|
3 |
from gtts import gTTS
|
|
|
1 |
+
import gradio_client.utils as gr_utils
|
2 |
+
|
3 |
+
def patched_get_type(schema):
|
4 |
+
# Check for a boolean schema
|
5 |
+
if isinstance(schema, bool):
|
6 |
+
return "Any" # Return a default type; adjust as needed.
|
7 |
+
# Otherwise, run the original logic.
|
8 |
+
# Note: This example assumes you can call the original if needed,
|
9 |
+
# otherwise, you might need to inline the rest of the function.
|
10 |
+
if "const" in schema:
|
11 |
+
# (Original logic here; you can copy over the code from the package.)
|
12 |
+
# For demonstration, we'll simply return a placeholder:
|
13 |
+
return "ConstType"
|
14 |
+
# You need to add the remaining conditions based on the original implementation.
|
15 |
+
return "Unknown"
|
16 |
+
|
17 |
+
# Apply the monkey patch.
|
18 |
+
gr_utils.get_type = patched_get_type
|
19 |
+
|
20 |
import gradio as gr
|
21 |
from langdetect import detect
|
22 |
from gtts import gTTS
|