Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
from PyPDF2 import PdfReader
|
3 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
4 |
from gtts import gTTS
|
|
|
5 |
import re
|
6 |
|
7 |
model_name = "ArtifactAI/led_large_16384_arxiv_summarization"
|
@@ -33,7 +34,8 @@ def summarize_pdf_abstract(pdf_file):
|
|
33 |
|
34 |
# Generate audio
|
35 |
speech = gTTS(text=summary_sentence, lang="en")
|
36 |
-
speech_bytes =
|
|
|
37 |
|
38 |
# Return individual output values
|
39 |
return summary_sentence, speech_bytes.getvalue()
|
|
|
2 |
from PyPDF2 import PdfReader
|
3 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
4 |
from gtts import gTTS
|
5 |
+
from io import BytesIO
|
6 |
import re
|
7 |
|
8 |
model_name = "ArtifactAI/led_large_16384_arxiv_summarization"
|
|
|
34 |
|
35 |
# Generate audio
|
36 |
speech = gTTS(text=summary_sentence, lang="en")
|
37 |
+
speech_bytes = BytesIO()
|
38 |
+
speech.write_to_fp(speech_bytes)
|
39 |
|
40 |
# Return individual output values
|
41 |
return summary_sentence, speech_bytes.getvalue()
|