Spaces:
Sleeping
Sleeping
import streamlit as st | |
import pymupdf | |
from io import StringIO | |
st.write("## Local RAG \n Get Insights from your documents") | |
file = st.file_uploader("Upload your Document Here", type=['pdf']) | |
if file is not None: | |
# doc = pymupdf.open(file) | |
# texts = [page.get_text().encode("utf-8") for page in doc] | |
# texts | |
# To read file as bytes: | |
bytes_data = file.getvalue() | |
with open("data/uploaded_file.pdf", "wb") as fp: | |
fp.write(bytes_data) | |
doc = pymupdf.open(fp) | |
texts = [page.get_text().encode("utf-8") for page in doc] | |
texts | |