uartimcs's picture
Update app.py
8df8cf7 verified
raw
history blame
339 Bytes
import gradio as gr
from pdf2image import convert_from_path
def pdf_to_jpg(pdf_path):
images = convert_from_path(pdf_path.name, first_page=1, last_page=1)
return images[0].save("first_page.jpg")
interface = gr.Interface(
fn=pdf_to_jpg,
inputs=gr.inputs.File(label="Upload PDF"),
outputs="image"
)
interface.launch()