itsmariamaraki commited on
Commit
f6b17be
β€’
1 Parent(s): 9d7af4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -45,17 +45,17 @@ def summarization_n_audiospeech(pdf_file):
45
 
46
  summary = summarization(abstract_text, max_length = 50, min_length = 10)[0]['summary_text'] #didn't know exactly what would give one sentence, so i checked multiple times the min & max lengths regarding the 11th article. for a dif article, those parameters would probably have to be different as well
47
 
48
- #fin_summary = summary.split('.')[0] + '.' #extract and print only the first sentence of the summary
49
 
50
  #converting the summarization into an audio output
51
- tts_output = audiospeech(summary)
52
  audio_data = tts_output['audio'][0]
53
 
54
  with BytesIO() as buffer:
55
  sf.write(buffer, audio_data, 16000, format = 'wav')
56
  audio_bytes = buffer.getvalue()
57
 
58
- return summary, audio_bytes
59
 
60
 
61
 
@@ -68,10 +68,7 @@ iface = gr.Interface(
68
  ],
69
  title = "PDF's Abstract Summarization & Audio Speech Processor",
70
  description = "App that generates a one-line summary of the abstract & a speech audio of this summarization -- requirements: app only accepts PDFs which include an ABSTRACT section",
71
- examples = [os.path.join(os.path.dirname(__file__), 'Hidden_Technical_Debt.pdf'),
72
- os.path.join(os.path.dirname(__file__), 'Semiconductors.pdf'),
73
- os.path.join(os.path.dirname(__file__), 'Efficient_Estimation_of_Word_Representations.pdf')
74
- ]
75
  )
76
 
77
  iface.launch()
 
45
 
46
  summary = summarization(abstract_text, max_length = 50, min_length = 10)[0]['summary_text'] #didn't know exactly what would give one sentence, so i checked multiple times the min & max lengths regarding the 11th article. for a dif article, those parameters would probably have to be different as well
47
 
48
+ fin_summary = summary.split('.', 1)[0] + '.' #extract and print only the first sentence of the summary
49
 
50
  #converting the summarization into an audio output
51
+ tts_output = audiospeech(fin_summarysummary)
52
  audio_data = tts_output['audio'][0]
53
 
54
  with BytesIO() as buffer:
55
  sf.write(buffer, audio_data, 16000, format = 'wav')
56
  audio_bytes = buffer.getvalue()
57
 
58
+ return fin_summary, audio_bytes
59
 
60
 
61
 
 
68
  ],
69
  title = "PDF's Abstract Summarization & Audio Speech Processor",
70
  description = "App that generates a one-line summary of the abstract & a speech audio of this summarization -- requirements: app only accepts PDFs which include an ABSTRACT section",
71
+ #examples = [os.path.join(os.path.dirname(__file__), 'Hidden_Technical_Debt.pdf'), os.path.join(os.path.dirname(__file__), 'Semiconductors.pdf'), os.path.join(os.path.dirname(__file__), 'Efficient_Estimation_of_Word_Representations.pdf') ]
 
 
 
72
  )
73
 
74
  iface.launch()