Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,21 @@ import gradio as gr
|
|
2 |
from transformers import AutoTokenizer, T5ForConditionalGeneration
|
3 |
import torch
|
4 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Set up device
|
7 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
2 |
from transformers import AutoTokenizer, T5ForConditionalGeneration
|
3 |
import torch
|
4 |
import os
|
5 |
+
import gradio_client.utils as client_utils
|
6 |
+
import sys
|
7 |
+
|
8 |
+
def _patched_json_schema_to_python_type(schema, defs=None, depth=0):
|
9 |
+
if depth > 100:
|
10 |
+
return "Any"
|
11 |
+
if isinstance(schema, bool):
|
12 |
+
return "Any" if schema else "None"
|
13 |
+
try:
|
14 |
+
return client_utils._json_schema_to_python_type(schema, defs)
|
15 |
+
except RecursionError:
|
16 |
+
return "Any"
|
17 |
+
|
18 |
+
client_utils._json_schema_to_python_type = _patched_json_schema_to_python_type
|
19 |
+
sys.setrecursionlimit(10000)
|
20 |
|
21 |
# Set up device
|
22 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|