Spaces:
Sleeping
Sleeping
File size: 1,196 Bytes
50f0958 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
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")
|