Spaces:
Build error
Build error
Commit ·
f988d10
1
Parent(s): 1504d7b
updated pom file
Browse files
app.py
CHANGED
|
@@ -65,17 +65,6 @@ elif genre==radioButtonList[4]:
|
|
| 65 |
|
| 66 |
isCustomURL = genre==radioButtonList[4]
|
| 67 |
urlInput = st.text_input('Enter your own URL', '', placeholder="Type your URL here (e.g. https://tinyurl.com/sbdxyt3t)", disabled=not isCustomURL)
|
| 68 |
-
if urlInput is not None:
|
| 69 |
-
urls = [urlInput]
|
| 70 |
-
loader = [UnstructuredURLLoader(urls=urls)]
|
| 71 |
-
index = VectorstoreIndexCreator(
|
| 72 |
-
embedding=GooglePalmEmbeddings(),
|
| 73 |
-
text_splitter=CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)).from_loaders(loader)
|
| 74 |
-
|
| 75 |
-
chain = RetrievalQA.from_chain_type(llm=llm,
|
| 76 |
-
chain_type="stuff",
|
| 77 |
-
retriever=index.vectorstore.as_retriever(),
|
| 78 |
-
input_key="question")
|
| 79 |
|
| 80 |
isCustomPDF = genre==radioButtonList[1] or genre==radioButtonList[2]
|
| 81 |
uploaded_file = st.file_uploader(f"Upload your own {pdfCSVURLText} here", type=pdfCSVURLText.lower(), disabled=not isCustomPDF)
|
|
@@ -134,5 +123,15 @@ if st.button(chatWithPDFButton, disabled=not enableChatBox and not chatTextStr):
|
|
| 134 |
st.write(answer)
|
| 135 |
|
| 136 |
elif genre==radioButtonList[4]: # Custom URL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
answer = chain.run(chatTextStr)
|
| 138 |
st.write(answer)
|
|
|
|
| 65 |
|
| 66 |
isCustomURL = genre==radioButtonList[4]
|
| 67 |
urlInput = st.text_input('Enter your own URL', '', placeholder="Type your URL here (e.g. https://tinyurl.com/sbdxyt3t)", 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)
|