Spaces:
Sleeping

File size: 1,232 Bytes
43280d3
 
 
 
 
 
eb158a5
43280d3
 
 
eb158a5
43280d3
 
 
 
 
 
eb158a5
43280d3
 
cb49361
 
 
 
43280d3
 
 
 
 
eb158a5
 
 
 
43280d3
 
 
eb158a5
 
 
 
 
 
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
36
37
38
39
40
41
42
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.v1.endpoints import matches, predict, pipeline
from app.core.config import settings
import logging

# 1. Setup Logging
logging.basicConfig(level=settings.LOG_LEVEL)
logger = logging.getLogger(__name__)

# 2. Create the ONE AND ONLY app instance
app = FastAPI(
    title="EPL Match Outcome Predictor",
    description="Predicts EPL match outcomes using Random Forest + engineered features",
    version="1.0.0",
)

# 3. Add Middleware
app.add_middleware(
    CORSMiddleware,
    allow_origins=[
        "http://localhost:3000",
        "https://epl-predictor-4drj.vercel.app/", # Your actual Vercel domain
    ],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# 4. Define Routes
@app.get("/")
def root():
    return {"status": "ok", "message": "EPL Predictor API is running"}

@app.get("/health")
def health_check():
    return {"status": "ok", "version": "1.0.0"}

# 5. Include Routers
app.include_router(matches.router,  prefix="/api/v1", tags=["Matches"])
app.include_router(predict.router,  prefix="/api/v1", tags=["Predictions"])
app.include_router(pipeline.router, prefix="/api/v1", tags=["Pipeline"])