MingDoan's picture
feat: Add VQA feature
4d5b0bf
raw
history blame
591 Bytes
import gradio as gr
from services.state import get_state
from controllers.vqa import vqa_controller
from utilities.constants import FW_DEFAULT_OPTION
def vqa_interface():
return gr.Interface(
title="Visual Question Answering",
fn=lambda image, question: vqa_controller(
image, question, get_state('fw_option', FW_DEFAULT_OPTION)),
inputs=[
gr.Image(type="pil", label="Input Image"),
gr.Textbox(label="Question")
],
outputs=[
gr.Textbox(label="Answer")
],
flagging_options=[]
)