Update main.py
Browse files
main.py
CHANGED
|
@@ -11,15 +11,23 @@ import logging
|
|
| 11 |
logging.basicConfig(level=logging.INFO)
|
| 12 |
logger = logging.getLogger(__name__)
|
| 13 |
|
| 14 |
-
app = FastAPI(
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
from doc_maker
|
| 20 |
app.include_router(doc_maker_router, prefix="/api/v1")
|
| 21 |
-
# from image_api import router as image_api_router
|
| 22 |
-
# app.include_router(image_api_router, prefix="/api/v1")
|
| 23 |
|
| 24 |
# API key configuration
|
| 25 |
CHAT_AUTH_KEY = os.getenv("CHAT_AUTH_KEY")
|
|
@@ -31,33 +39,10 @@ async def verify_api_key(api_key: str = Security(api_key_header)):
|
|
| 31 |
raise HTTPException(status_code=403, detail="Could not validate credentials")
|
| 32 |
return api_key
|
| 33 |
|
| 34 |
-
# @app.get("/test")
|
| 35 |
-
# async def test(api_key: str = Depends(verify_api_key)):
|
| 36 |
-
# result = await simple_crawl("https://www.nbcnews.com/business")
|
| 37 |
-
# return {"markdown": result.markdown}
|
| 38 |
-
|
| 39 |
-
from fastapi.middleware.cors import CORSMiddleware
|
| 40 |
-
|
| 41 |
# CORS middleware setup
|
| 42 |
app.add_middleware(
|
| 43 |
CORSMiddleware,
|
| 44 |
-
|
| 45 |
-
# allow_origins=[
|
| 46 |
-
# "http://127.0.0.1:5501/",
|
| 47 |
-
# "http://localhost:5501",
|
| 48 |
-
# "http://localhost:3000",
|
| 49 |
-
# "https://www.elevaticsai.com",
|
| 50 |
-
# "https://www.elevatics.cloud",
|
| 51 |
-
# "https://www.elevatics.online",
|
| 52 |
-
# "https://www.elevatics.ai",
|
| 53 |
-
# "https://elevaticsai.com",
|
| 54 |
-
# "https://elevatics.cloud",
|
| 55 |
-
# "https://elevatics.online",
|
| 56 |
-
# "https://elevatics.ai",
|
| 57 |
-
# "https://web.elevatics.cloud",
|
| 58 |
-
# "https://pvanand-specialized-agents.hf.space",
|
| 59 |
-
# "https://pvanand-audio-chat.hf.space/"
|
| 60 |
-
# ],
|
| 61 |
allow_credentials=True,
|
| 62 |
allow_methods=["GET", "POST"],
|
| 63 |
allow_headers=["*"],
|
|
|
|
| 11 |
logging.basicConfig(level=logging.INFO)
|
| 12 |
logger = logging.getLogger(__name__)
|
| 13 |
|
| 14 |
+
app = FastAPI(
|
| 15 |
+
title="FastAPI",
|
| 16 |
+
version="0.1.0",
|
| 17 |
+
servers=[
|
| 18 |
+
{
|
| 19 |
+
"url": "https://pvanand-doc-maker.hf.space", # Your production URL
|
| 20 |
+
"description": "Production server"
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"url": "http://localhost:8000", # Local development URL
|
| 24 |
+
"description": "Local development server"
|
| 25 |
+
}
|
| 26 |
+
]
|
| 27 |
+
)
|
| 28 |
|
| 29 |
+
from doc_maker import router as doc_maker_router
|
| 30 |
app.include_router(doc_maker_router, prefix="/api/v1")
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# API key configuration
|
| 33 |
CHAT_AUTH_KEY = os.getenv("CHAT_AUTH_KEY")
|
|
|
|
| 39 |
raise HTTPException(status_code=403, detail="Could not validate credentials")
|
| 40 |
return api_key
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
# CORS middleware setup
|
| 43 |
app.add_middleware(
|
| 44 |
CORSMiddleware,
|
| 45 |
+
allow_origins=["*"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
allow_credentials=True,
|
| 47 |
allow_methods=["GET", "POST"],
|
| 48 |
allow_headers=["*"],
|