vmalapaka's picture
Update pages/LoadData.py
9a39d34 verified
Raw History Blame Contribute Delete
1.05 kB
import streamlit as st
from pages.utils import *
def main():
st.set_page_config(page_title="Dump PDF to Pinecone - Vector Store")
st.title("Upload your files ")
# Upload the pdf
pdf = st.file_uploader("Only PDF format", type=["pdf"])
# Extract the whole text from the uploaded pdf file
if pdf is not None:
with st.spinner('Loading'):
text=read_pdf_data(pdf)
st.write("Reading PDF complete")
# Create chunks
docs_chunks=split_data(text)
st.write("Split data into chunks")
# Create the embeddings
embeddings=create_embeddings_load_data()
st.write("Created embeddings instance")
import os
os.environ["PINECONE_API_KEY"] = "50b78f61-9dee-49b1-af4e-131a7f73ccdc"
push_to_pinecone(os.getenv("PINECONE_API_KEY"),"us-east-1","document",embeddings,docs_chunks)
st.success("Successfully pushed the embeddings to Pinecone")
if __name__ == '__main__':
main()