Skip to content

Instantly share code, notes, and snippets.

@salma71
Last active January 22, 2021 20:39
Show Gist options
  • Save salma71/5346c7465caef878464dec6a404a28cd to your computer and use it in GitHub Desktop.
Save salma71/5346c7465caef878464dec6a404a28cd to your computer and use it in GitHub Desktop.
from gtts import gTTS
from pdfminer.high_level import extract_text
import gradio as gr
def pdf_to_text(file_obj):
text = extract_text(file_obj.name)
myobj = gTTS(text=text, lang='en', slow=False)
myobj.save("output.wav")
return 'output.wav'
iface = gr.Interface(
fn = pdf_to_text,
inputs = 'file',
outputs = 'audio'
)
iface.launch()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment