Spaces:
Runtime error
Runtime error
#**************** IMPORT PACKAGES ******************** | |
import gradio as gr | |
import numpy as np | |
import os | |
import re | |
import tempfile | |
from zipfile import ZipFile | |
pip install gtts | |
pip install pdfminer.six | |
from gtts import gTTS | |
from pdfminer.high_level import extract_text | |
def pdf_to_text(text, PDF): | |
if text == "": | |
# The setup of huggingface.co | |
file_obj = PDF | |
#n = int(Percent.replace('%', '')) | |
text = extract_text(file_obj.name) | |
outpit_text = text | |
else: | |
output_text = text | |
# Generate Summary | |
myobj = gTTS(text=output_text, lang='en', slow=False) | |
myobj.save("audio.wav") | |
return "audio.wav" | |
# return path | |
#pageObject.extractText() | |
iface = gr.Interface(fn = pdf_to_text, | |
inputs =["text", "file"], outputs=["audio"] ) | |
if __name__ == "__main__": | |
iface.launch(share=True) |