Spaces:
No application file
No application file
| """ | |
| hf_app.py | |
| ========= | |
| Hugging Face Spaces Entry point. | |
| This script launches the API server and provides a small Gradio UI | |
| for manual testing if accessed via a browser on HF. | |
| """ | |
| import os | |
| import sys | |
| # Add project root to path | |
| sys.path.insert(0, os.getcwd()) | |
| import uvicorn | |
| from ai_firewall.api_server import app | |
| if __name__ == "__main__": | |
| # HF Spaces uses port 7860 by default for Gradio, | |
| # but we can run our FastAPI server on any port | |
| # assigned by the environment. | |
| port = int(os.environ.get("PORT", 8000)) | |
| print(f"๐ Launching AI Firewall on port {port}...") | |
| uvicorn.run(app, host="0.0.0.0", port=port) | |