Spaces:
Sleeping
Sleeping
import os | |
import sys | |
import uvicorn | |
from pathlib import Path | |
# Change to the current directory and add to Python path | |
current_dir = Path(__file__).parent | |
os.chdir(current_dir) | |
sys.path.insert(0, str(current_dir)) | |
print("π Starting SafeSpace AI API...") | |
print("π Models directory:", current_dir / "models") | |
print("π Server will be available at: http://localhost:8000") | |
print("π API Documentation: http://localhost:8000/docs") | |
print("π Health Check: http://localhost:8000/health") | |
print("π§ ML Models Status: http://localhost:8000/api/models/status") | |
print("π― Threat Analysis: http://localhost:8000/api/threats/demo") | |
print("\n" + "="*60) | |
if __name__ == "__main__": | |
try: | |
uvicorn.run( | |
"server.main:app", | |
host="0.0.0.0", | |
port=8000, | |
reload=True, # Enable reload for development | |
log_level="info" | |
) | |
except KeyboardInterrupt: | |
print("\nπ Server stopped by user") | |
except Exception as e: | |
print(f"β Error starting server: {e}") | |
print("Make sure you have installed the requirements:") | |
print("pip install -r requirements.txt") | |