Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,7 +68,11 @@ def _run_inference(image: Image.Image) -> list[dict[str, object]]:
|
|
| 68 |
return [detector.predict(image).as_dict() for detector in detectors]
|
| 69 |
|
| 70 |
|
| 71 |
-
run_inference =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
@app.post("/v1/detect")
|
|
|
|
| 68 |
return [detector.predict(image).as_dict() for detector in detectors]
|
| 69 |
|
| 70 |
|
| 71 |
+
run_inference = (
|
| 72 |
+
spaces.GPU(duration=120)(_run_inference)
|
| 73 |
+
if spaces is not None and os.getenv("USE_ZEROGPU", "false").lower() == "true"
|
| 74 |
+
else _run_inference
|
| 75 |
+
)
|
| 76 |
|
| 77 |
|
| 78 |
@app.post("/v1/detect")
|