Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- Dockerfile +3 -1
- server/app.py +4 -2
Dockerfile
CHANGED
|
@@ -83,5 +83,7 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
| 83 |
|
| 84 |
# Run the FastAPI server
|
| 85 |
# The module path is constructed to work with the /app/env structure
|
|
|
|
|
|
|
| 86 |
ENV ENABLE_WEB_INTERFACE=true
|
| 87 |
-
CMD ["sh", "-c", "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000"]
|
|
|
|
| 83 |
|
| 84 |
# Run the FastAPI server
|
| 85 |
# The module path is constructed to work with the /app/env structure
|
| 86 |
+
# --ws-ping-interval none --ws-ping-timeout none: Disable WebSocket ping/pong
|
| 87 |
+
# to prevent timeout errors during long-running operations (e.g., token generation)
|
| 88 |
ENV ENABLE_WEB_INTERFACE=true
|
| 89 |
+
CMD ["sh", "-c", "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000 --ws-ping-interval none --ws-ping-timeout none"]
|
server/app.py
CHANGED
|
@@ -79,11 +79,13 @@ def main(host: str = "0.0.0.0", port: int = 8000):
|
|
| 79 |
|
| 80 |
For production deployments, consider using uvicorn directly with
|
| 81 |
multiple workers:
|
| 82 |
-
uvicorn textarena_env.server.app:app --workers 4
|
| 83 |
"""
|
| 84 |
import uvicorn
|
| 85 |
|
| 86 |
-
|
|
|
|
|
|
|
| 87 |
|
| 88 |
|
| 89 |
if __name__ == "__main__":
|
|
|
|
| 79 |
|
| 80 |
For production deployments, consider using uvicorn directly with
|
| 81 |
multiple workers:
|
| 82 |
+
uvicorn textarena_env.server.app:app --workers 4 --ws-ping-interval none --ws-ping-timeout none
|
| 83 |
"""
|
| 84 |
import uvicorn
|
| 85 |
|
| 86 |
+
# Disable WebSocket ping/pong to prevent timeout errors during
|
| 87 |
+
# long-running operations (e.g., token generation during training)
|
| 88 |
+
uvicorn.run(app, host=host, port=port, ws_ping_interval=None, ws_ping_timeout=None)
|
| 89 |
|
| 90 |
|
| 91 |
if __name__ == "__main__":
|