warisqr007 commited on
Commit
71392e7
·
1 Parent(s): 3103427
Files changed (2) hide show
  1. app.py +37 -37
  2. requirements.txt +7 -7
app.py CHANGED
@@ -25,43 +25,43 @@ MODEL_REPO_ID = os.getenv("MODEL_REPO_ID", "warisqr007/StreamingVocos")
25
  CKPT_FILENAME = os.getenv("CKPT_FILENAME", "epoch=3.ckpt")
26
  SAMPLE_RATE = int(os.getenv("SAMPLE_RATE", "16000"))
27
 
28
- def safe_get_type(schema):
29
- # First handle booleans (previous error)
30
- if isinstance(schema, bool):
31
- return "boolean"
32
- if "const" in schema:
33
- return "const"
34
- if "enum" in schema:
35
- return "enum"
36
- if "type" in schema:
37
- return schema["type"]
38
- if schema.get("$ref"):
39
- return "$ref"
40
- if schema.get("oneOf"):
41
- return "oneOf"
42
- if schema.get("anyOf"):
43
- return "anyOf"
44
- if schema.get("allOf"):
45
- return "allOf"
46
- if "type" not in schema:
47
- return {}
48
- raise grc_utils.APIInfoParseError(f"Cannot parse type for {schema}")
49
-
50
- grc_utils.get_type = safe_get_type
51
- orig__json_schema_to_python_type = grc_utils._json_schema_to_python_type
52
-
53
- def patched__json_schema_to_python_type(schema, defs=None):
54
- # Handle the specific "string or null" pattern that caused your crash
55
- if isinstance(schema, dict) and schema.get("anyOf"):
56
- # Extract non-null types
57
- non_null = [s for s in schema["anyOf"] if s.get("type") != "null"]
58
- if len(non_null) == 1 and non_null[0].get("type") == "string":
59
- # Represent as optional string
60
- return "str | None"
61
- # Fallback to original behavior if it's some other pattern
62
- return orig__json_schema_to_python_type(schema, defs)
63
-
64
- grc_utils._json_schema_to_python_type = patched__json_schema_to_python_type
65
 
66
 
67
  def _fig_to_rgb_array(fig):
 
25
  CKPT_FILENAME = os.getenv("CKPT_FILENAME", "epoch=3.ckpt")
26
  SAMPLE_RATE = int(os.getenv("SAMPLE_RATE", "16000"))
27
 
28
+ # def safe_get_type(schema):
29
+ # # First handle booleans (previous error)
30
+ # if isinstance(schema, bool):
31
+ # return "boolean"
32
+ # if "const" in schema:
33
+ # return "const"
34
+ # if "enum" in schema:
35
+ # return "enum"
36
+ # if "type" in schema:
37
+ # return schema["type"]
38
+ # if schema.get("$ref"):
39
+ # return "$ref"
40
+ # if schema.get("oneOf"):
41
+ # return "oneOf"
42
+ # if schema.get("anyOf"):
43
+ # return "anyOf"
44
+ # if schema.get("allOf"):
45
+ # return "allOf"
46
+ # if "type" not in schema:
47
+ # return {}
48
+ # raise grc_utils.APIInfoParseError(f"Cannot parse type for {schema}")
49
+
50
+ # grc_utils.get_type = safe_get_type
51
+ # orig__json_schema_to_python_type = grc_utils._json_schema_to_python_type
52
+
53
+ # def patched__json_schema_to_python_type(schema, defs=None):
54
+ # # Handle the specific "string or null" pattern that caused your crash
55
+ # if isinstance(schema, dict) and schema.get("anyOf"):
56
+ # # Extract non-null types
57
+ # non_null = [s for s in schema["anyOf"] if s.get("type") != "null"]
58
+ # if len(non_null) == 1 and non_null[0].get("type") == "string":
59
+ # # Represent as optional string
60
+ # return "str | None"
61
+ # # Fallback to original behavior if it's some other pattern
62
+ # return orig__json_schema_to_python_type(schema, defs)
63
+
64
+ # grc_utils._json_schema_to_python_type = patched__json_schema_to_python_type
65
 
66
 
67
  def _fig_to_rgb_array(fig):
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  # --------- python --------- #
2
- numpy>=1.23,<2.0
3
  matplotlib
4
  pandas
5
  scipy
@@ -9,7 +9,7 @@ pyloudnorm
9
  scikit-learn
10
  onnxruntime
11
  seaborn
12
- pyarrow>=14.0.0
13
 
14
  # --------- pytorch --------- #
15
  torch
@@ -33,10 +33,10 @@ einops
33
  soundfile
34
 
35
  # --------- gradio / hub --------- #
36
- gradio>=4.44.1,<5.0
37
- gradio_client>=1.3.0,<2.0
38
- pydantic>=2.8,<2.11
39
  # huggingface_hub>=0.23.5
40
- huggingface_hub>=0.25.0,<1.0.0
41
- transformers<5.0
42
  datasets
 
1
  # --------- python --------- #
2
+ numpy #>=1.23,<2.0
3
  matplotlib
4
  pandas
5
  scipy
 
9
  scikit-learn
10
  onnxruntime
11
  seaborn
12
+ # pyarrow>=14.0.0
13
 
14
  # --------- pytorch --------- #
15
  torch
 
33
  soundfile
34
 
35
  # --------- gradio / hub --------- #
36
+ gradio #>=4.44.1,<5.0
37
+ # gradio_client>=1.3.0,<2.0
38
+ # pydantic>=2.8,<2.11
39
  # huggingface_hub>=0.23.5
40
+ huggingface_hub #>=0.25.0,<1.0.0
41
+ transformers #<5.0
42
  datasets