Spaces:
Runtime error
Runtime error
Download app/main.py from Abdullahcoder54/Hackaton1_BOOK_chatbot: direct link, hf CLI and curl.
- Browser
- Download file 570 Bytes
-
https://huggingface.co/spaces/Abdullahcoder54/Hackaton1_BOOK_chatbot/resolve/main/app/main.py
- Command line
-
hf download hf://spaces/Abdullahcoder54/Hackaton1_BOOK_chatbot/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/Abdullahcoder54/Hackaton1_BOOK_chatbot/resolve/main/app/main.py
570 Bytes
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from .api import query, translate # Import the new translate router | |
| app = FastAPI() | |
| # Add CORS middleware to allow requests from the frontend | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # Allows all origins | |
| allow_credentials=True, | |
| allow_methods=["*"], # Allows all methods | |
| allow_headers=["*"], # Allows all headers | |
| ) | |
| app.include_router(query.router, prefix="/api") | |
| app.include_router(translate.router, prefix="/api") # Include the new translate router |