Spaces:
Sleeping
Sleeping
Commit
·
390cad0
1
Parent(s):
f7b5a30
updated pom file
Browse files
app.py
CHANGED
@@ -62,19 +62,9 @@ elif genre==radioButtonList[3]:
|
|
62 |
input_key="question")
|
63 |
elif genre==radioButtonList[4]:
|
64 |
pdfCSVURLText = "URL"
|
65 |
-
urlInput = st.text_input('Enter your own URL', '', placeholder="Type your URL here (e.g. https://abc.xyz/investor/)", disabled=not genre==radioButtonList[4])
|
66 |
-
urls = [urlInput]
|
67 |
-
loader = [UnstructuredURLLoader(urls=urls)]
|
68 |
-
index = VectorstoreIndexCreator(
|
69 |
-
embedding=GooglePalmEmbeddings(),
|
70 |
-
text_splitter=CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)).from_loaders(loader)
|
71 |
-
|
72 |
-
chain = RetrievalQA.from_chain_type(llm=llm,
|
73 |
-
chain_type="stuff",
|
74 |
-
retriever=index.vectorstore.as_retriever(),
|
75 |
-
input_key="question")
|
76 |
|
77 |
-
|
|
|
78 |
|
79 |
isCustomPDF = genre==radioButtonList[1] or genre==radioButtonList[2]
|
80 |
uploaded_file = st.file_uploader(f"Upload your own {pdfCSVURLText} here", type=pdfCSVURLText.lower(), disabled=not isCustomPDF)
|
@@ -133,5 +123,15 @@ if st.button(chatWithPDFButton, disabled=not enableChatBox and not chatTextStr):
|
|
133 |
st.write(answer)
|
134 |
|
135 |
elif genre==radioButtonList[4]: # Custom URL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
answer = chain.run(chatTextStr)
|
137 |
st.write(answer)
|
|
|
62 |
input_key="question")
|
63 |
elif genre==radioButtonList[4]:
|
64 |
pdfCSVURLText = "URL"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
+
isCustomURL = genre==radioButtonList[4]
|
67 |
+
urlInput = st.text_input('Enter your own URL', '', placeholder="Type your URL here (e.g. https://abc.xyz/investor/)", disabled=not isCustomURL)
|
68 |
|
69 |
isCustomPDF = genre==radioButtonList[1] or genre==radioButtonList[2]
|
70 |
uploaded_file = st.file_uploader(f"Upload your own {pdfCSVURLText} here", type=pdfCSVURLText.lower(), disabled=not isCustomPDF)
|
|
|
123 |
st.write(answer)
|
124 |
|
125 |
elif genre==radioButtonList[4]: # Custom URL
|
126 |
+
urls = [urlInput]
|
127 |
+
loader = [UnstructuredURLLoader(urls=urls)]
|
128 |
+
index = VectorstoreIndexCreator(
|
129 |
+
embedding=GooglePalmEmbeddings(),
|
130 |
+
text_splitter=CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)).from_loaders(loader)
|
131 |
+
|
132 |
+
chain = RetrievalQA.from_chain_type(llm=llm,
|
133 |
+
chain_type="stuff",
|
134 |
+
retriever=index.vectorstore.as_retriever(),
|
135 |
+
input_key="question")
|
136 |
answer = chain.run(chatTextStr)
|
137 |
st.write(answer)
|