Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -115,11 +115,15 @@ if spaces is not None:
|
|
| 115 |
|
| 116 |
if __name__ == "__main__":
|
| 117 |
if spaces is not None:
|
|
|
|
| 118 |
platform_status.launch(
|
| 119 |
server_name="0.0.0.0",
|
| 120 |
server_port=int(os.getenv("PORT", "7860")),
|
| 121 |
-
|
| 122 |
)
|
|
|
|
|
|
|
|
|
|
| 123 |
else:
|
| 124 |
import uvicorn
|
| 125 |
|
|
|
|
| 115 |
|
| 116 |
if __name__ == "__main__":
|
| 117 |
if spaces is not None:
|
| 118 |
+
device, detectors, load_errors = load_detectors()
|
| 119 |
platform_status.launch(
|
| 120 |
server_name="0.0.0.0",
|
| 121 |
server_port=int(os.getenv("PORT", "7860")),
|
| 122 |
+
prevent_thread_lock=True,
|
| 123 |
)
|
| 124 |
+
platform_status.server_app.add_api_route("/health", health, methods=["GET"])
|
| 125 |
+
platform_status.server_app.add_api_route("/v1/detect", detect, methods=["POST"])
|
| 126 |
+
platform_status.block_thread()
|
| 127 |
else:
|
| 128 |
import uvicorn
|
| 129 |
|