Spaces:
Sleeping
Sleeping
Commit
·
1504d7b
1
Parent(s):
61022d4
updated pom file
Browse files
app.py
CHANGED
@@ -50,7 +50,7 @@ elif genre==radioButtonList[2]:
|
|
50 |
pdfCSVURLText = "PDF"
|
51 |
elif genre==radioButtonList[3]:
|
52 |
pdfCSVURLText = "URL"
|
53 |
-
urls = ['https://finance.yahoo.com/quote/GOOG/financials?p=GOOG'
|
54 |
loader = [UnstructuredURLLoader(urls=urls)]
|
55 |
index = VectorstoreIndexCreator(
|
56 |
embedding=GooglePalmEmbeddings(),
|
@@ -65,6 +65,17 @@ 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 |
|
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,4 +134,5 @@ if st.button(chatWithPDFButton, disabled=not enableChatBox and not chatTextStr):
|
|
123 |
st.write(answer)
|
124 |
|
125 |
elif genre==radioButtonList[4]: # Custom URL
|
126 |
-
|
|
|
|
50 |
pdfCSVURLText = "PDF"
|
51 |
elif genre==radioButtonList[3]:
|
52 |
pdfCSVURLText = "URL"
|
53 |
+
urls = ['https://finance.yahoo.com/quote/GOOG/financials?p=GOOG']
|
54 |
loader = [UnstructuredURLLoader(urls=urls)]
|
55 |
index = VectorstoreIndexCreator(
|
56 |
embedding=GooglePalmEmbeddings(),
|
|
|
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 |
st.write(answer)
|
135 |
|
136 |
elif genre==radioButtonList[4]: # Custom URL
|
137 |
+
answer = chain.run(chatTextStr)
|
138 |
+
st.write(answer)
|