Spaces:
Sleeping
Sleeping
Nihar Shah
Add: uv.lock, project.scripts entry point, and server/app.py for multi-mode deployment
ac6af92 Download server/app.py from NiharS/OpenEnv-CRM-Query-final: direct link, hf CLI and curl.
- Browser
- Download file 854 Bytes
-
https://huggingface.co/spaces/NiharS/OpenEnv-CRM-Query-final/resolve/main/server/app.py
- Command line
-
hf download hf://spaces/NiharS/OpenEnv-CRM-Query-final/server/app.py
-
curl -L -o app.py https://huggingface.co/spaces/NiharS/OpenEnv-CRM-Query-final/resolve/main/server/app.py
854 Bytes
| #!/usr/bin/env python3 | |
| """ | |
| FastAPI application entry point for OpenEnv CRM Query Environment | |
| Serves the environment for HuggingFace Spaces and other deployment modes | |
| """ | |
| import os | |
| import sys | |
| import uvicorn | |
| from pathlib import Path | |
| # Add parent directory to path to import app module | |
| sys.path.insert(0, str(Path(__file__).parent.parent)) | |
| from app.main import app | |
| def main(): | |
| """Main entry point for the server""" | |
| # Get configuration from environment or use defaults | |
| host = os.getenv("HOST", "0.0.0.0") | |
| port = int(os.getenv("PORT", "7860")) | |
| # For HuggingFace Spaces, use port 7860 | |
| if os.getenv("SPACE_ID"): | |
| port = 7860 | |
| # Run uvicorn server | |
| uvicorn.run( | |
| app, | |
| host=host, | |
| port=port, | |
| log_level="info", | |
| access_log=True, | |
| ) | |
| if __name__ == "__main__": | |
| main() | |