Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -16,6 +16,17 @@ from fiberpose.domain import AppConfig # noqa: E402
|
|
| 16 |
from fiberpose.paths import EXAMPLE_IMAGE_PATH, default_config_path # noqa: E402
|
| 17 |
from fiberpose.web import launch # noqa: E402
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
# Analyse the example once so the first visitor does not wait for numba to compile.
|
| 20 |
fiberpose.analyze(iio.imread(EXAMPLE_IMAGE_PATH))
|
| 21 |
|
|
|
|
| 16 |
from fiberpose.paths import EXAMPLE_IMAGE_PATH, default_config_path # noqa: E402
|
| 17 |
from fiberpose.web import launch # noqa: E402
|
| 18 |
|
| 19 |
+
# ZeroGPU hardware refuses to start an app without a @spaces.GPU function. Fiberpose runs on
|
| 20 |
+
# the CPU, so this one is never called and uses no GPU quota; elsewhere it does nothing.
|
| 21 |
+
try:
|
| 22 |
+
import spaces
|
| 23 |
+
|
| 24 |
+
@spaces.GPU
|
| 25 |
+
def _zerogpu_placeholder() -> None:
|
| 26 |
+
pass
|
| 27 |
+
except ImportError: # not running on a Space
|
| 28 |
+
pass
|
| 29 |
+
|
| 30 |
# Analyse the example once so the first visitor does not wait for numba to compile.
|
| 31 |
fiberpose.analyze(iio.imread(EXAMPLE_IMAGE_PATH))
|
| 32 |
|