autotldr / app /main.py
dev2004v's picture
Update app/main.py
d6cc012 verified
raw
history blame contribute delete
703 Bytes
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)