Spaces:
Running on Zero
Running on Zero
[Admin maintenance] Support new ZeroGPU hardware
#35
by multimodalart HF Staff - opened
- README.md +1 -0
- run/gradio_ootd.py +17 -0
README.md
CHANGED
|
@@ -5,6 +5,7 @@ colorFrom: yellow
|
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 4.36.1
|
|
|
|
| 8 |
app_file: ./run/gradio_ootd.py
|
| 9 |
pinned: false
|
| 10 |
license: cc-by-nc-sa-4.0
|
|
|
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 4.36.1
|
| 8 |
+
python_version: "3.10"
|
| 9 |
app_file: ./run/gradio_ootd.py
|
| 10 |
pinned: false
|
| 11 |
license: cc-by-nc-sa-4.0
|
run/gradio_ootd.py
CHANGED
|
@@ -1,4 +1,21 @@
|
|
| 1 |
import spaces
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
import os
|
|
|
|
| 1 |
import spaces
|
| 2 |
+
# --- compat shim: torchvision >=0.17 removed torchvision.transforms.functional_tensor,
|
| 3 |
+
# which basicsr/gfpgan/facexlib still import from. Re-create it as an alias module
|
| 4 |
+
# pointing at torchvision.transforms.functional (which has the same tensor-capable fns).
|
| 5 |
+
import sys as _sys, types as _types
|
| 6 |
+
try:
|
| 7 |
+
import torchvision.transforms.functional as _tv_functional
|
| 8 |
+
if "torchvision.transforms.functional_tensor" not in _sys.modules:
|
| 9 |
+
_functional_tensor_shim = _types.ModuleType("torchvision.transforms.functional_tensor")
|
| 10 |
+
for _name in ("rgb_to_grayscale", "adjust_brightness", "adjust_contrast",
|
| 11 |
+
"adjust_hue", "adjust_saturation", "normalize"):
|
| 12 |
+
if hasattr(_tv_functional, _name):
|
| 13 |
+
setattr(_functional_tensor_shim, _name, getattr(_tv_functional, _name))
|
| 14 |
+
_sys.modules["torchvision.transforms.functional_tensor"] = _functional_tensor_shim
|
| 15 |
+
except Exception:
|
| 16 |
+
pass
|
| 17 |
+
# --- end compat shim ---
|
| 18 |
+
|
| 19 |
|
| 20 |
import gradio as gr
|
| 21 |
import os
|