Spaces:
Runtime error
Runtime error
Download backend/api/pdfreader.py from Drago1995/AI-New-Question-Generator: direct link, hf CLI and curl.
- Browser
- Download file 476 Bytes
-
https://huggingface.co/spaces/Drago1995/AI-New-Question-Generator/resolve/main/backend/api/pdfreader.py
- Command line
-
hf download hf://spaces/Drago1995/AI-New-Question-Generator/backend/api/pdfreader.py
-
curl -L -o pdfreader.py https://huggingface.co/spaces/Drago1995/AI-New-Question-Generator/resolve/main/backend/api/pdfreader.py
476 Bytes
| from fastapi import APIRouter, UploadFile, File, HTTPException | |
| from backend.services.pdfreader_service import PDFService | |
| router = APIRouter(prefix="/pdfreader", tags=["items"]) | |
| service = PDFService() | |
| async def upload_pdf(file: UploadFile = File(...)): | |
| if not file.filename.endswith(".pdf"): | |
| raise HTTPException(status_code=400, detail="Only PDF files are allowed") | |
| result = await service.process_uploaded_pdf(file) | |
| return result | |