markytools commited on
Commit
ef1eb58
·
1 Parent(s): 674ea12

updated pom file

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -65,6 +65,15 @@ if uploaded_file is not None:
65
  uploadedFilename = f.name
66
  if genre==radioButtonList[1]: # Custom CSV Upload
67
  dataDF = pd.read_csv(uploadedFilename, encoding= 'unicode_escape')
 
 
 
 
 
 
 
 
 
68
 
69
  enableChatBox = False
70
  if genre==radioButtonList[0]: # E-commerce CSV
@@ -96,7 +105,10 @@ if st.button(chatWithPDFButton, disabled=not enableChatBox and not chatTextStr):
96
  st.write(answer)
97
 
98
  elif genre==radioButtonList[2]: # Custom PDF Upload
99
- pass
 
 
 
100
  elif genre==radioButtonList[3]: # Google Alphabet URL Earnings Report
101
  pass
102
  elif genre==radioButtonList[4]: # Custom URL
 
65
  uploadedFilename = f.name
66
  if genre==radioButtonList[1]: # Custom CSV Upload
67
  dataDF = pd.read_csv(uploadedFilename, encoding= 'unicode_escape')
68
+ elif genre==radioButtonList[2]: # Custom PDF Upload
69
+ pdf_loaders = [UnstructuredPDFLoader(uploadedFilename)]
70
+ pdf_index = VectorstoreIndexCreator(
71
+ embedding=GooglePalmEmbeddings(),
72
+ text_splitter=CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)).from_loaders(pdf_loaders)
73
+ pdf_chain = RetrievalQA.from_chain_type(llm=llm,
74
+ chain_type="stuff",
75
+ retriever=pdf_index.vectorstore.as_retriever(),
76
+ input_key="question")
77
 
78
  enableChatBox = False
79
  if genre==radioButtonList[0]: # E-commerce CSV
 
105
  st.write(answer)
106
 
107
  elif genre==radioButtonList[2]: # Custom PDF Upload
108
+ pdf_answer = pdf_chain.run(chatTextStr)
109
+ pdf_answer
110
+ st.write(pdf_answer)
111
+
112
  elif genre==radioButtonList[3]: # Google Alphabet URL Earnings Report
113
  pass
114
  elif genre==radioButtonList[4]: # Custom URL