This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from fastapi import FastAPI, HTTPException, Query | |
| from typing import Optional | |
| import fitz | |
| import requests | |
| app = FastAPI() | |
| def extract_text_from_pdf(pdf_path, max_pages: Optional[int] = None): | |
| doc = fitz.open(pdf_path) | |
| text = "" |