Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
+
from app.api.endpoints import router as api_router
|
| 4 |
+
from app.core.config import settings
|
| 5 |
+
|
| 6 |
+
app = FastAPI(
|
| 7 |
+
title="Indian Financial Compliance API",
|
| 8 |
+
description="API for Indian financial compliance analysis and stock data",
|
| 9 |
+
version="1.0.0"
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
# Configure CORS
|
| 13 |
+
app.add_middleware(
|
| 14 |
+
CORSMiddleware,
|
| 15 |
+
allow_origins=["*"], # In production, replace with your Streamlit app URL
|
| 16 |
+
allow_credentials=True,
|
| 17 |
+
allow_methods=["*"],
|
| 18 |
+
allow_headers=["*"],
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Include API router
|
| 22 |
+
app.include_router(api_router, prefix="/api/v1")
|
| 23 |
+
|
| 24 |
+
@app.get("/")
|
| 25 |
+
async def root():
|
| 26 |
+
return {"message": "Indian Financial Compliance API"}
|
| 27 |
+
|
| 28 |
+
@app.get("/health")
|
| 29 |
+
async def health_check():
|
| 30 |
+
return {"status": "healthy", "api_key_configured": bool(settings.API_KEY)}
|