Spaces:
Running on Zero
Running on Zero
Upload 43 files
Browse files- src/main.py +2 -2
- src/vision/florence.py +3 -0
src/main.py
CHANGED
|
@@ -10,8 +10,8 @@ def main():
|
|
| 10 |
print(f"Starting {CONFIG.APP_NAME} v{CONFIG.APP_VERSION}")
|
| 11 |
|
| 12 |
assistant = SightLineAssistant()
|
| 13 |
-
# Load model
|
| 14 |
-
|
| 15 |
|
| 16 |
demo = build_ui(assistant)
|
| 17 |
|
|
|
|
| 10 |
print(f"Starting {CONFIG.APP_NAME} v{CONFIG.APP_VERSION}")
|
| 11 |
|
| 12 |
assistant = SightLineAssistant()
|
| 13 |
+
# Load model synchronously for ZeroGPU compatibility
|
| 14 |
+
assistant.initialize()
|
| 15 |
|
| 16 |
demo = build_ui(assistant)
|
| 17 |
|
src/vision/florence.py
CHANGED
|
@@ -83,6 +83,9 @@ class FlorenceVisionEngine(VisionEngine):
|
|
| 83 |
|
| 84 |
def _warmup(self):
|
| 85 |
"""Run a dummy inference to warm up kernels."""
|
|
|
|
|
|
|
|
|
|
| 86 |
try:
|
| 87 |
dummy = Image.new("RGB", (224, 224), 128)
|
| 88 |
self._run_inference(dummy, "<CAPTION>")
|
|
|
|
| 83 |
|
| 84 |
def _warmup(self):
|
| 85 |
"""Run a dummy inference to warm up kernels."""
|
| 86 |
+
if IS_SPACES:
|
| 87 |
+
print("Skipping warmup on ZeroGPU Spaces")
|
| 88 |
+
return
|
| 89 |
try:
|
| 90 |
dummy = Image.new("RGB", (224, 224), 128)
|
| 91 |
self._run_inference(dummy, "<CAPTION>")
|