Spaces:
Runtime error
Runtime error
Update gradio_app.py
Browse files- gradio_app.py +20 -0
gradio_app.py
CHANGED
|
@@ -225,6 +225,26 @@ def inference(id_image, hair_image):
|
|
| 225 |
bald_head,
|
| 226 |
) = _import_inference_bits()
|
| 227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
os.makedirs("gradio_inputs", exist_ok=True)
|
| 229 |
os.makedirs("gradio_outputs", exist_ok=True)
|
| 230 |
|
|
|
|
| 225 |
bald_head,
|
| 226 |
) = _import_inference_bits()
|
| 227 |
|
| 228 |
+
# Disable StyleGAN2 custom CUDA ops to avoid JIT compiling (needs ninja/NVCC).
|
| 229 |
+
# ZeroGPU 下建议走纯 PyTorch 引用实现,避免扩展编译失败。
|
| 230 |
+
try:
|
| 231 |
+
from HairMapper.styleGAN2_ada_model.stylegan2_ada.torch_utils.ops import bias_act as _bias_act
|
| 232 |
+
_bias_act.USING_CUDA_TO_SPEED_UP = False
|
| 233 |
+
try:
|
| 234 |
+
from HairMapper.styleGAN2_ada_model.stylegan2_ada.torch_utils.ops import upfirdn2d as _upfirdn2d
|
| 235 |
+
if hasattr(_upfirdn2d, 'USING_CUDA_TO_SPEED_UP'):
|
| 236 |
+
_upfirdn2d.USING_CUDA_TO_SPEED_UP = False
|
| 237 |
+
except Exception:
|
| 238 |
+
pass
|
| 239 |
+
try:
|
| 240 |
+
from HairMapper.styleGAN2_ada_model.stylegan2_ada.torch_utils.ops import filtered_lrelu as _fl
|
| 241 |
+
if hasattr(_fl, 'USING_CUDA_TO_SPEED_UP'):
|
| 242 |
+
_fl.USING_CUDA_TO_SPEED_UP = False
|
| 243 |
+
except Exception:
|
| 244 |
+
pass
|
| 245 |
+
except Exception:
|
| 246 |
+
pass
|
| 247 |
+
|
| 248 |
os.makedirs("gradio_inputs", exist_ok=True)
|
| 249 |
os.makedirs("gradio_outputs", exist_ok=True)
|
| 250 |
|