Daniellesry commited on
Commit
53c249d
·
1 Parent(s): 4880d13
Files changed (1) hide show
  1. app.py +44 -42
app.py CHANGED
@@ -11,44 +11,45 @@ from loguru import logger
11
  from tqdm import tqdm
12
  from tools.common_utils import save_video
13
  from dkt.pipelines.wan_video_new import WanVideoPipeline, ModelConfig
14
- try:
15
- import gradio_client.utils as _gc_utils
16
- if hasattr(_gc_utils, "get_type"):
17
- _orig_get_type = _gc_utils.get_type
18
- def _get_type_safe(schema):
19
- if not isinstance(schema, dict):
20
- return "Any"
21
- return _orig_get_type(schema)
22
- _gc_utils.get_type = _get_type_safe
23
- except Exception:
24
- pass
25
-
26
- # Additional guard: handle boolean JSON Schemas and parsing errors
27
- try:
28
- import gradio_client.utils as _gc_utils
29
- # Wrap the internal _json_schema_to_python_type if present
30
- if hasattr(_gc_utils, "_json_schema_to_python_type"):
31
- _orig_internal = _gc_utils._json_schema_to_python_type
32
- def _json_schema_to_python_type_safe(schema, defs=None):
33
- if isinstance(schema, bool):
34
- return "Any"
35
- try:
36
- return _orig_internal(schema, defs)
37
- except Exception:
38
- return "Any"
39
- _gc_utils._json_schema_to_python_type = _json_schema_to_python_type_safe
40
-
41
- # Also wrap the public json_schema_to_python_type to be extra defensive
42
- if hasattr(_gc_utils, "json_schema_to_python_type"):
43
- _orig_public = _gc_utils.json_schema_to_python_type
44
- def json_schema_to_python_type_safe(schema):
45
- try:
46
- return _orig_public(schema)
47
- except Exception:
48
- return "Any"
49
- _gc_utils.json_schema_to_python_type = json_schema_to_python_type_safe
50
- except Exception:
51
- pass
 
52
 
53
  import cv2
54
  import copy
@@ -690,10 +691,11 @@ if __name__ == '__main__':
690
  logger.info('model init done!')
691
  print('model init done!')
692
 
693
- # demo.queue().launch(share = True)
694
- demo.queue(
695
- api_open=False,
696
- ).launch()
 
697
 
698
 
699
  # server_name="0.0.0.0", server_port=7860
 
11
  from tqdm import tqdm
12
  from tools.common_utils import save_video
13
  from dkt.pipelines.wan_video_new import WanVideoPipeline, ModelConfig
14
+
15
+ # try:
16
+ # import gradio_client.utils as _gc_utils
17
+ # if hasattr(_gc_utils, "get_type"):
18
+ # _orig_get_type = _gc_utils.get_type
19
+ # def _get_type_safe(schema):
20
+ # if not isinstance(schema, dict):
21
+ # return "Any"
22
+ # return _orig_get_type(schema)
23
+ # _gc_utils.get_type = _get_type_safe
24
+ # except Exception:
25
+ # pass
26
+
27
+ # # Additional guard: handle boolean JSON Schemas and parsing errors
28
+ # try:
29
+ # import gradio_client.utils as _gc_utils
30
+ # # Wrap the internal _json_schema_to_python_type if present
31
+ # if hasattr(_gc_utils, "_json_schema_to_python_type"):
32
+ # _orig_internal = _gc_utils._json_schema_to_python_type
33
+ # def _json_schema_to_python_type_safe(schema, defs=None):
34
+ # if isinstance(schema, bool):
35
+ # return "Any"
36
+ # try:
37
+ # return _orig_internal(schema, defs)
38
+ # except Exception:
39
+ # return "Any"
40
+ # _gc_utils._json_schema_to_python_type = _json_schema_to_python_type_safe
41
+
42
+ # # Also wrap the public json_schema_to_python_type to be extra defensive
43
+ # if hasattr(_gc_utils, "json_schema_to_python_type"):
44
+ # _orig_public = _gc_utils.json_schema_to_python_type
45
+ # def json_schema_to_python_type_safe(schema):
46
+ # try:
47
+ # return _orig_public(schema)
48
+ # except Exception:
49
+ # return "Any"
50
+ # _gc_utils.json_schema_to_python_type = json_schema_to_python_type_safe
51
+ # except Exception:
52
+ # pass
53
 
54
  import cv2
55
  import copy
 
691
  logger.info('model init done!')
692
  print('model init done!')
693
 
694
+ demo.queue().launch(share = True)
695
+
696
+ # demo.queue(
697
+ # api_open=False,
698
+ # ).launch()
699
 
700
 
701
  # server_name="0.0.0.0", server_port=7860