Download routers/books/reference.py from aliroya32/ContiAI: direct link, hf CLI and curl.
- Browser
- Download file 692 Bytes
-
https://huggingface.co/spaces/aliroya32/ContiAI/resolve/main/routers/books/reference.py
- Command line
-
hf download hf://spaces/aliroya32/ContiAI/routers/books/reference.py
-
curl -L -o reference.py https://huggingface.co/spaces/aliroya32/ContiAI/resolve/main/routers/books/reference.py
692 Bytes
| from fastapi import APIRouter, HTTPException | |
| from fastapi.responses import HTMLResponse | |
| from agents.books.reference_lang import ( | |
| run_references, | |
| ) | |
| router = APIRouter(prefix="/book", tags=["Books"]) | |
| async def process_book( | |
| book_json: dict , | |
| ): | |
| try: | |
| if not book_json: | |
| raise HTTPException(status_code=400, detail="لا توجد بيانات مرسلة") | |
| html_content = run_references(book_json) | |
| return HTMLResponse(content=html_content, status_code=200) | |
| except HTTPException: | |
| raise | |
| except Exception as e: | |
| raise HTTPException(status_code=500, detail=f"خطأ في التحويل: {str(e)}") | |