Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,6 @@ def pdf_to_document_store(pdf_file):
|
|
34 |
|
35 |
def summarize(file):
|
36 |
pdf_to_document_store(file)
|
37 |
-
st.write('Number of documents', document_store.get_document_count())
|
38 |
summaries = summarizer.predict(documents=document_store.get_all_documents(), generate_single_summary=True)
|
39 |
return summaries
|
40 |
|
@@ -45,6 +44,10 @@ def set_state_if_absent(key, value):
|
|
45 |
set_state_if_absent("summaries", None)
|
46 |
document_store, summarizer, preprocessor = start_haystack()
|
47 |
|
|
|
|
|
|
|
|
|
48 |
uploaded_file = st.file_uploader("Choose a PDF file", accept_multiple_files=False)
|
49 |
|
50 |
if uploaded_file is not None:
|
|
|
34 |
|
35 |
def summarize(file):
|
36 |
pdf_to_document_store(file)
|
|
|
37 |
summaries = summarizer.predict(documents=document_store.get_all_documents(), generate_single_summary=True)
|
38 |
return summaries
|
39 |
|
|
|
44 |
set_state_if_absent("summaries", None)
|
45 |
document_store, summarizer, preprocessor = start_haystack()
|
46 |
|
47 |
+
st.markdown( """
|
48 |
+
This Summarization demo uses a [Haystack TransformerSummarizer node](https://haystack.deepset.ai/pipeline_nodes/summarizer). You can upload a PDF file, which will be converted to text with the [Haystack PDFtoTextConverter](https://haystack.deepset.ai/reference/file-converters#pdftotextconverter). In this demo, we produce 1 summary for the whole file you upload. So, the TransformerSummarizer treats the while thing as one string, which means along with the model limitations, PDFs that have a lot of unneeded text at the beginning produce poor results.
|
49 |
+
""", unsafe_allow_html=True)
|
50 |
+
|
51 |
uploaded_file = st.file_uploader("Choose a PDF file", accept_multiple_files=False)
|
52 |
|
53 |
if uploaded_file is not None:
|