sblumenf's picture
Update app.py
a69dbfc
raw
history blame
500 Bytes
import gradio as gr
import pdfminer
from pdfminer.high_level import extract_text
import urllib.request
def read_pdf(file=None, url=None):
if file:
text = extract_text(file.name)
elif url:
response = urllib.request.urlopen(url)
file = response.read()
text = extract_text(file)
return text
iface = gr.Interface(
read_pdf,
gr.inputs.File(),
gr.inputs.Textbox(prompt="Enter a URL that points to a pdf"),
gr.outputs.Textbox()
)
iface.launch()