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(), gr.outputs.Textbox() ) iface.launch()