Spaces:
Runtime error
Runtime error
Download backend/api/textreader.py from Drago1995/AI-New-Question-Generator: direct link, hf CLI and curl.
- Browser
- Download file 578 Bytes
-
https://huggingface.co/spaces/Drago1995/AI-New-Question-Generator/resolve/main/backend/api/textreader.py
- Command line
-
hf download hf://spaces/Drago1995/AI-New-Question-Generator/backend/api/textreader.py
-
curl -L -o textreader.py https://huggingface.co/spaces/Drago1995/AI-New-Question-Generator/resolve/main/backend/api/textreader.py
578 Bytes
| from fastapi import APIRouter, HTTPException | |
| from backend.services.TextReaderQuestionGenerator import TextReaderQuestionGenerator | |
| from pydantic import BaseModel | |
| router = APIRouter(prefix="/txt", tags=["items"]) | |
| service = TextReaderQuestionGenerator() | |
| # Define the request model | |
| class TextRequest(BaseModel): | |
| txt: str | |
| async def read_text(request: TextRequest): | |
| if not request.txt: | |
| raise HTTPException(status_code=400, detail="No text provided") | |
| result = await service.textreader_question_generator(request.txt) | |
| return result | |