wiusdy's picture
using 3 new models of VQA
c5797b7
raw
history blame
814 Bytes
import gradio as gr
import os
from inference import Inference
from utils import *
inference = Inference()
with gr.Blocks() as block:
options = gr.Dropdown(choices=["Model 1", "Model 2", "Model 3"], label="Models", info="Select the model to use..")
txt = gr.Textbox(label="Insert a question..", lines=2)
txt_3 = gr.Textbox(value="", label="Your answer is here..")
btn = gr.Button(value="Submit")
dogs = os.path.join(os.path.dirname(__file__), "617.jpg")
image = gr.Image(type="pil", value=dogs)
btn.click(inference.inference_vilt, inputs=[image, txt], outputs=[txt_3])
btn = gr.Button(value="Submit")
iface = gr.Interface(
fn=lambda: "Selected Model: " + options.value,
inputs=block,
outputs="text",
live=False
)
if __name__ == "__main__":
iface.launch()