Spaces:
Build error
Build error
File size: 1,054 Bytes
c7038b3 9a39d34 c7038b3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 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()
|