jiuface commited on
Commit
dc3dc0f
·
verified ·
1 Parent(s): 94a5c60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -5,6 +5,25 @@ import time
5
  import numpy as np
6
  from PIL import Image
7
  import requests
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  import torch
9
 
10
  from diffusers import StableDiffusionControlNetImg2ImgPipeline, ControlNetModel, DDIMScheduler
 
5
  import numpy as np
6
  from PIL import Image
7
  import requests
8
+ # === Fix gradio_client 0.15.1 bug: bool schema not handled ===
9
+ import gradio_client.utils as _gcu
10
+
11
+ _orig_get_type = _gcu.get_type
12
+ def _patched_get_type(schema):
13
+ if not isinstance(schema, dict):
14
+ return "Any"
15
+ return _orig_get_type(schema)
16
+ _gcu.get_type = _patched_get_type
17
+
18
+ _orig_json_to_py = _gcu._json_schema_to_python_type
19
+ def _patched_json_to_py(schema, defs=None):
20
+ if isinstance(schema, bool):
21
+ return "bool"
22
+ return _orig_json_to_py(schema, defs)
23
+ _gcu._json_schema_to_python_type = _patched_json_to_py
24
+ # === end fix ===
25
+
26
+ import spaces
27
  import torch
28
 
29
  from diffusers import StableDiffusionControlNetImg2ImgPipeline, ControlNetModel, DDIMScheduler