varl42 commited on
Commit
4c3923d
1 Parent(s): 2753e83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -22,7 +22,7 @@ def summarize_text(text):
22
  break
23
  abstract = ". ".join(sentences[start:end+1])
24
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
25
- summary = summarizer(abstract, max_length=50, min_length=50)
26
  return summary[0]['summary_text']
27
 
28
  def text_to_audio(text):
@@ -32,7 +32,7 @@ def text_to_audio(text):
32
  buffer.seek(0)
33
  return buffer.read()
34
 
35
- def summarize_pdf(pdf_file):
36
  text = extract_text(pdf_file)
37
  summary = summarize_text(text)
38
  audio = text_to_audio(summary)
@@ -42,10 +42,10 @@ inputs = gr.File()
42
  audio_summary = gr.Audio()
43
 
44
  iface = gr.Interface(
45
- fn=summarize_pdf,
46
  inputs=inputs,
47
  outputs=audio_summary,
48
  title="PDF Summarizer"
49
  )
50
 
51
- iface.launch()
 
22
  break
23
  abstract = ". ".join(sentences[start:end+1])
24
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
25
+ summary = summarizer(abstract, max_length=50, min_length=30)
26
  return summary[0]['summary_text']
27
 
28
  def text_to_audio(text):
 
32
  buffer.seek(0)
33
  return buffer.read()
34
 
35
+ def audio_pdf(pdf_file):
36
  text = extract_text(pdf_file)
37
  summary = summarize_text(text)
38
  audio = text_to_audio(summary)
 
42
  audio_summary = gr.Audio()
43
 
44
  iface = gr.Interface(
45
+ fn=audio_pdf,
46
  inputs=inputs,
47
  outputs=audio_summary,
48
  title="PDF Summarizer"
49
  )
50
 
51
+ iface.launch()