File size: 703 Bytes
ae63de2
 
 
 
d6cc012
ae63de2
d6cc012
 
 
 
ae63de2
 
 
 
d6cc012
ae63de2
 
d6cc012
ae63de2
 
 
 
 
 
d6cc012
ae63de2
 
d6cc012
ae63de2
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
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.routes import summarize
import os
import logging

# Configure basic logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")

# Cache location (for Hugging Face Spaces)
os.environ['TRANSFORMERS_CACHE'] = '/tmp/hf_cache'

app = FastAPI()

# Enable CORS for all origins (safe here)
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_methods=["*"],
    allow_headers=["*"],
)

@app.get("/")
def read_root():
    logging.info("Health check hit.")
    return {"message": "AutoTLDR backend is running"}

# Mount routes
app.include_router(summarize.router)