Babyloncoder's picture
Create app.py
53195f4 verified
raw
history blame
581 Bytes
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()