Spaces:
Sleeping
Sleeping
Upload server/app.py with huggingface_hub
Browse files- server/app.py +28 -0
server/app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Server entry point for OpenEnv multi-mode deployment.
|
| 3 |
+
|
| 4 |
+
This module re-exports the FastAPI app from the root app module
|
| 5 |
+
and provides a CLI entry point for `[project.scripts]`.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import sys
|
| 9 |
+
import os
|
| 10 |
+
|
| 11 |
+
# Ensure root directory is on path for imports
|
| 12 |
+
_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 13 |
+
if _root not in sys.path:
|
| 14 |
+
sys.path.insert(0, _root)
|
| 15 |
+
|
| 16 |
+
from app import app # noqa: E402 — re-export the FastAPI app
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def main():
|
| 20 |
+
"""Entry point for [project.scripts] server command."""
|
| 21 |
+
import uvicorn
|
| 22 |
+
|
| 23 |
+
port = int(os.environ.get("PORT", 7860))
|
| 24 |
+
uvicorn.run(app, host="0.0.0.0", port=port)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
if __name__ == "__main__":
|
| 28 |
+
main()
|