Spaces:
Runtime error
Runtime error
import gradio as gr | |
from io import BytesIO | |
from pdfminer.high_level import extract_text | |
import requests | |
def read_pdf(file): | |
if isinstance(file, str): | |
if file.startswith('http'): | |
file = BytesIO(requests.get(file).content) | |
text = extract_text(file) | |
return text | |
iface = gr.Interface(fn=read_pdf, inputs="file_upload", outputs="text", | |
title="PDF Text Extractor", | |
description="Extract text from a PDF file.") | |
iface.launch() | |