Spaces:
Runtime error
Runtime error
File size: 499 Bytes
8b8735d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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()
|