import gradio as gr def get_answer(image, question) -> str: return "I don't know" with gr.Blocks() as demo: with gr.Row(): with gr.Column(): image_url = gr.Textbox(lines=1, label="Image URL", placeholder="Paste image URL here") if image_url.value: image = gr.Image(image_url) else: # Or upload from your computer image = gr.Image(shape=(224, 224)) with gr.Column(): gr.Markdown( """ # OCR-VQA-Donut This demo using fine-tuned OCR-VQA-Donut model to answer questions about images. Feel free to try it out! """) question = gr.Textbox(lines=5, label="Question") answer = gr.Label(label="Answer") ask = gr.Button(label="Get the answer") ask.click(get_answer, inputs=[image, question], outputs=[answer]) demo.launch()