Spaces:
Running on Zero
Running on Zero
Fix ZeroGPU startup: import spaces before torch and disable hot reload
Browse files- kimodo/demo/app.py +10 -0
kimodo/demo/app.py
CHANGED
|
@@ -10,6 +10,16 @@ import time
|
|
| 10 |
from typing import Optional
|
| 11 |
|
| 12 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
import torch
|
| 14 |
|
| 15 |
import viser
|
|
|
|
| 10 |
from typing import Optional
|
| 11 |
|
| 12 |
import numpy as np
|
| 13 |
+
|
| 14 |
+
# Import spaces before any CUDA-related imports in HF Spaces to avoid
|
| 15 |
+
# ZeroGPU startup race conditions from background threads.
|
| 16 |
+
try:
|
| 17 |
+
import spaces # type: ignore # noqa: F401
|
| 18 |
+
|
| 19 |
+
os.environ["GRADIO_HOT_RELOAD"] = "False"
|
| 20 |
+
except (ImportError, RuntimeError):
|
| 21 |
+
pass
|
| 22 |
+
|
| 23 |
import torch
|
| 24 |
|
| 25 |
import viser
|