Tuana commited on
Commit
28ec4f0
β€’
1 Parent(s): 374d67a

converting back to streamlit

Browse files
Files changed (2) hide show
  1. README.md +2 -2
  2. app.py +6 -14
README.md CHANGED
@@ -3,8 +3,8 @@ title: URL Summarizer
3
  emoji: 🏒
4
  colorFrom: indigo
5
  colorTo: indigo
6
- sdk: gradio
7
- sdk_version: 3.0.2
8
  app_file: app.py
9
  pinned: false
10
  ---
 
3
  emoji: 🏒
4
  colorFrom: indigo
5
  colorTo: indigo
6
+ sdk: streamlit
7
+ sdk_version: 1.9.0
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -1,4 +1,4 @@
1
- import gradio as gr
2
  from haystack.document_stores import InMemoryDocumentStore
3
  from haystack.nodes import FARMReader, PreProcessor, PDFToTextConverter, TfidfRetriever
4
  import logging
@@ -24,18 +24,10 @@ def pdf_to_document_store(pdf_files):
24
  preprocessed_docs = preprocessor.process(documents)
25
  document_store.write_documents(preprocessed_docs)
26
  return None
 
 
27
 
 
 
 
28
 
29
- def summarize(files):
30
- if files is not None:
31
- document_store.delete_all_documents()
32
- pdf_to_document_store(files)
33
- return document_store.get_document_count()
34
-
35
- title = "Summarize one or more PDFs with a Haystack Summariser pipeline"
36
- iface = gr.Interface(fn=summarize,
37
- inputs=[gr.inputs.File(file_count="multiple", type="file", label="Upload some PDFs")],
38
- outputs="text",
39
- title=title,
40
- theme="huggingface")
41
- iface.launch()
 
1
+ import streamlit as st
2
  from haystack.document_stores import InMemoryDocumentStore
3
  from haystack.nodes import FARMReader, PreProcessor, PDFToTextConverter, TfidfRetriever
4
  import logging
 
24
  preprocessed_docs = preprocessor.process(documents)
25
  document_store.write_documents(preprocessed_docs)
26
  return None
27
+
28
+ uploaded_files = st.file_uploader("Choose PDF files", accept_multiple_files=True)
29
 
30
+ if uploaded_files is not None:
31
+ pdf_to_document_store(uploaded_files)
32
+ st.write(document_store.get_document_count)
33