gianb commited on
Commit
c1262c3
·
1 Parent(s): 95b7a91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def summarize_pdf(pdf_path):
2
+ pdf_file = open(pdf_path, 'rb')
3
+ pdf_reader = PyPDF2.PdfReader(pdf_file)
4
+ abstract_text = pdf_reader.pages[0].extract_text()
5
+ summary = summarization(abstract_text, max_length=13, min_length=10)[0]['summary_text']
6
+ pdf_file.close()
7
+ return summary
8
+
9
+ iface = gr.Interface(
10
+ fn=summarize_pdf,
11
+ inputs= "file",
12
+ outputs="text",
13
+ live=True,
14
+ title="PDF Summarizer",
15
+ description="Upload a PDF with an abstract, and the model will generate a summary."
16
+ )