Spaces:
Runtime error
Runtime error
Commit
·
9d7af4d
1
Parent(s):
623620b
Update app.py
Browse files
app.py
CHANGED
@@ -43,19 +43,19 @@ audiospeech = pipeline('text-to-speech', model = 'suno/bark-small') #the voice i
|
|
43 |
def summarization_n_audiospeech(pdf_file):
|
44 |
abstract_text = abstract(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(
|
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
|
59 |
|
60 |
|
61 |
|
|
|
43 |
def summarization_n_audiospeech(pdf_file):
|
44 |
abstract_text = abstract(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 |
|