uartimcs's picture
Update app.py
bb230bf verified
raw
history blame
332 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.File(label="Upload PDF"),
outputs="image"
)
interface.launch()