Spaces:
Runtime error
Runtime error
| """ | |
| Simple script to run the FastAPI application. | |
| """ | |
| import uvicorn | |
| import sys | |
| import os | |
| def main(): | |
| """Run the FastAPI application.""" | |
| # Get port from environment variable or use default | |
| port = int(os.getenv("PORT", "8000")) | |
| # Get host from environment variable or use default | |
| host = os.getenv("HOST", "0.0.0.0") | |
| # Check if reload flag is passed | |
| reload = "--reload" in sys.argv or "-r" in sys.argv | |
| print("="*60) | |
| print("๐ Phishing URL Detection API") | |
| print("="*60) | |
| print(f"Starting server on {host}:{port}") | |
| print(f"Reload mode: {'Enabled' if reload else 'Disabled'}") | |
| print(f"\nAPI Documentation:") | |
| print(f" - Swagger UI: http://{host if host != '0.0.0.0' else 'localhost'}:{port}/docs") | |
| print(f" - ReDoc: http://{host if host != '0.0.0.0' else 'localhost'}:{port}/redoc") | |
| print("="*60) | |
| uvicorn.run( | |
| "main:app", | |
| host=host, | |
| port=port, | |
| reload=reload, | |
| log_level="info" | |
| ) | |
| if __name__ == "__main__": | |
| main() | |