Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -770,18 +770,15 @@ else:
|
|
| 770 |
csvexcelattachment = None
|
| 771 |
|
| 772 |
if pdf_mode:
|
| 773 |
-
pdf_docs = st.file_uploader("Upload your PDF Files and Click on the Submit & Process Button")
|
| 774 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 775 |
else:
|
| 776 |
pdf_docs = None
|
| 777 |
|
| 778 |
-
if pdf_docs:
|
| 779 |
-
if st.button("Submit & Process"):
|
| 780 |
-
with st.spinner("Processing..."):
|
| 781 |
-
raw_text = get_pdf_text(pdf_docs)
|
| 782 |
-
text_chunks = get_text_chunks(raw_text)
|
| 783 |
-
get_vector_store(text_chunks)
|
| 784 |
-
st.success("Done")
|
| 785 |
else:
|
| 786 |
print("")
|
| 787 |
|
|
@@ -816,7 +813,7 @@ if prompt:
|
|
| 816 |
|
| 817 |
if image or url != '':
|
| 818 |
if url != '':
|
| 819 |
-
img = Image.open(requests.get(
|
| 820 |
else:
|
| 821 |
img = Image.open(image)
|
| 822 |
prmt = {'role': 'user', 'parts':[prompt+txt, img]}
|
|
|
|
| 770 |
csvexcelattachment = None
|
| 771 |
|
| 772 |
if pdf_mode:
|
| 773 |
+
pdf_docs = st.file_uploader("Upload your PDF Files and Click on the Submit & Process Button", accept_multiple_files=False)
|
| 774 |
+
with st.spinner("Processing..."):
|
| 775 |
+
raw_text = get_pdf_text(pdf_docs)
|
| 776 |
+
text_chunks = get_text_chunks(raw_text)
|
| 777 |
+
get_vector_store(text_chunks)
|
| 778 |
+
st.success("Done")
|
| 779 |
else:
|
| 780 |
pdf_docs = None
|
| 781 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 782 |
else:
|
| 783 |
print("")
|
| 784 |
|
|
|
|
| 813 |
|
| 814 |
if image or url != '':
|
| 815 |
if url != '':
|
| 816 |
+
img = Image.open(requests.get(url, stream=True).raw)
|
| 817 |
else:
|
| 818 |
img = Image.open(image)
|
| 819 |
prmt = {'role': 'user', 'parts':[prompt+txt, img]}
|