Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,10 @@ import gradio as gr
|
|
3 |
import tempfile
|
4 |
from pathlib import Path
|
5 |
import base64
|
6 |
-
import fitz
|
|
|
|
|
|
|
7 |
# Import vectorstore and embeddings from langchain community package
|
8 |
from langchain_community.vectorstores import FAISS
|
9 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
@@ -11,9 +14,6 @@ from langchain_community.embeddings import HuggingFaceEmbeddings
|
|
11 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
12 |
# HF Inference client for multimodal model
|
13 |
from huggingface_hub import InferenceClient
|
14 |
-
# Unstructured for PDF processing with image extraction
|
15 |
-
from unstructured.partition.pdf import partition_pdf
|
16 |
-
from unstructured.partition.utils.constants import PartitionStrategy
|
17 |
|
18 |
# ββ Globals βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
19 |
index = None # FAISS index storing document embeddings
|
|
|
3 |
import tempfile
|
4 |
from pathlib import Path
|
5 |
import base64
|
6 |
+
import fitz # PyMuPDF - works on HF Spaces without additional dependencies
|
7 |
+
from PIL import Image
|
8 |
+
import io
|
9 |
+
|
10 |
# Import vectorstore and embeddings from langchain community package
|
11 |
from langchain_community.vectorstores import FAISS
|
12 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
|
|
14 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
15 |
# HF Inference client for multimodal model
|
16 |
from huggingface_hub import InferenceClient
|
|
|
|
|
|
|
17 |
|
18 |
# ββ Globals βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
19 |
index = None # FAISS index storing document embeddings
|