Spaces:
Runtime error
Runtime error
File size: 581 Bytes
53195f4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from transformers import pipeline
# Load the VQA model
oracle = pipeline(model="dandelin/vilt-b32-finetuned-vqa")
# Define a function to use the model
def answer_question(image, question):
response = oracle(question=question, image=image)
return response[0]['answer']
# Import the specific input and output components directly
from gradio import Image, Textbox
# Create the Gradio interface
interface = gr.Interface(
fn=answer_question,
inputs=[Image(type="filepath"), Textbox()],
outputs=Textbox()
)
# Launch the app
interface.launch() |