1javid commited on
Commit
3ffa8eb
·
1 Parent(s): b8f8364

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -3,15 +3,11 @@ from transformers import pipeline
3
  from pathlib import Path
4
  from llama_index import download_loader
5
 
6
- def main():
7
- st.title("PDF Summarizer")
8
- uploaded_file = st.file_uploader("Upload a PDF file")
9
- if uploaded_file is not None:
10
- loader = PDFReader()
11
- documents = loader.load_data(file=Path(uploaded_file.name))
12
- summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
13
- summary = summarizer(str(documents[0]), max_length=130, min_length=30, do_sample=False)
14
- st.write(summary[0]["summary_text"])
15
-
16
- if __name__ == "__main__":
17
- main()
 
3
  from pathlib import Path
4
  from llama_index import download_loader
5
 
6
+ st.title("PDF Summarizer")
7
+ uploaded_file = st.file_uploader("Upload a PDF file")
8
+ if uploaded_file is not None:
9
+ loader = PDFReader()
10
+ documents = loader.load_data(file=Path(uploaded_file.name))
11
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
12
+ summary = summarizer(str(documents[0]), max_length=130, min_length=30, do_sample=False)
13
+ st.write(summary[0]["summary_text"])