Spaces:
Sleeping
Sleeping
File size: 449 Bytes
8b8735d 8ee8372 6bba4b2 a69dbfc 8b8735d ab26203 8b8735d 8ee8372 ab26203 8ee8372 8b8735d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
import pdfminer
from pdfminer.high_level import extract_text
import urllib.request
def read_pdf(file, url):
if url is not None and url != "":
file = urllib.request.urlretrieve(url)[0]
text = extract_text(file)
return text
iface = gr.Interface(
read_pdf,
gr.inputs.File(examples='path/to/example_pdf_files'),
gr.inputs.Textbox(label="Enter URL of pdf"),
gr.outputs.Textbox()
)
iface.launch()
|