Skip to content

Commit

Permalink
use pymupdf import instead of fitz
Browse files Browse the repository at this point in the history
  • Loading branch information
Elehiggle committed Jun 4, 2024
1 parent 1835eb5 commit 39ca718
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
from defusedxml import ElementTree
import yfinance
import certifi

# noinspection PyPackageRequirements
import fitz
import pymupdf
import pymupdf4llm
import httpx
from PIL import Image
Expand Down Expand Up @@ -116,7 +114,7 @@ def wrapped_f(*args, **kwargs):
tools = [
{
"name": "raw_html_to_image",
"description": "Generates an image from raw HTML code. You can also pass a URL which will be screenshotted, but only do that if its specifically requested.",
"description": "Generates an image from raw HTML code. You can also pass a URL which will be screenshotted, but only do that if a screenshot is specifically requested.",
"input_schema": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1013,7 +1011,7 @@ def extract_pdf_content(stream):
pdf_text_content = ""
image_messages = []

with fitz.open(None, stream, "pdf") as pdf:
with pymupdf.open(None, stream, "pdf") as pdf:
pdf_text_content += pymupdf4llm.to_markdown(pdf).strip()

for page in pdf:
Expand Down

0 comments on commit 39ca718

Please sign in to comment.