import gradio as gr from services.state import get_state from controllers.img2text import img2text_controller from utilities.constants import FW_DEFAULT_OPTION def img2text_interface(): return gr.Interface( title="Image to Text", fn=lambda image: img2text_controller( image, get_state('fw_option', FW_DEFAULT_OPTION)), inputs=[ gr.Image(type="pil", label="Input Image"), ], outputs=[ gr.Textbox(label="Caption") ], flagging_options=[] )