Spaces:
Runtime error
Runtime error
Commit
·
f0ae978
1
Parent(s):
9152041
updated wrt gtts
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pyttsx3
|
| 3 |
import PyPDF2
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
def pdf_to_audio(pdf_file):
|
|
@@ -10,8 +11,8 @@ def pdf_to_audio(pdf_file):
|
|
| 10 |
text += pdf_reader.pages[page].extract_text()
|
| 11 |
|
| 12 |
engine = pyttsx3.init()
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
|
| 17 |
demo = gr.Blocks()
|
|
@@ -24,4 +25,4 @@ with demo:
|
|
| 24 |
|
| 25 |
b1.click(pdf_to_audio, inputs=pdf_file, outputs=text)
|
| 26 |
|
| 27 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pyttsx3
|
| 3 |
import PyPDF2
|
| 4 |
+
import gTTS
|
| 5 |
|
| 6 |
|
| 7 |
def pdf_to_audio(pdf_file):
|
|
|
|
| 11 |
text += pdf_reader.pages[page].extract_text()
|
| 12 |
|
| 13 |
engine = pyttsx3.init()
|
| 14 |
+
speech = gTTS(text=text, lang="en")
|
| 15 |
+
speech.save("output.mp3")
|
| 16 |
|
| 17 |
|
| 18 |
demo = gr.Blocks()
|
|
|
|
| 25 |
|
| 26 |
b1.click(pdf_to_audio, inputs=pdf_file, outputs=text)
|
| 27 |
|
| 28 |
+
demo.launch()
|