Spaces:
Sleeping
Sleeping
catastropiyush
commited on
Commit
•
fca96f2
1
Parent(s):
2ecc901
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,6 @@ from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
|
6 |
from llama_index.core import Settings
|
7 |
import os
|
8 |
import base64
|
9 |
-
import fitz # PyMuPDF
|
10 |
|
11 |
# Load environment variables
|
12 |
load_dotenv()
|
@@ -32,21 +31,6 @@ DATA_DIR = "data"
|
|
32 |
os.makedirs(DATA_DIR, exist_ok=True)
|
33 |
os.makedirs(PERSIST_DIR, exist_ok=True)
|
34 |
|
35 |
-
|
36 |
-
def displayPDF(file):
|
37 |
-
# Open the PDF file
|
38 |
-
pdf_document = fitz.open(file)
|
39 |
-
# Render the first page
|
40 |
-
first_page = pdf_document.load_page(0)
|
41 |
-
# Convert the page to an image
|
42 |
-
pix = first_page.get_pixmap()
|
43 |
-
# Save the image
|
44 |
-
image_path = "first_page.png"
|
45 |
-
pix.save(image_path)
|
46 |
-
# Display the image in Streamlit
|
47 |
-
st.image(image_path)
|
48 |
-
|
49 |
-
|
50 |
def data_ingestion():
|
51 |
documents = SimpleDirectoryReader(DATA_DIR).load_data()
|
52 |
storage_context = StorageContext.from_defaults()
|
|
|
6 |
from llama_index.core import Settings
|
7 |
import os
|
8 |
import base64
|
|
|
9 |
|
10 |
# Load environment variables
|
11 |
load_dotenv()
|
|
|
31 |
os.makedirs(DATA_DIR, exist_ok=True)
|
32 |
os.makedirs(PERSIST_DIR, exist_ok=True)
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
def data_ingestion():
|
35 |
documents = SimpleDirectoryReader(DATA_DIR).load_data()
|
36 |
storage_context = StorageContext.from_defaults()
|