Spaces:
Sleeping
Sleeping
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() | |