File size: 646 Bytes
7c918e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
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)