import gradio as gr from PIL import Image # For image handling # Replace with paths or loading functions for your specific models def load_model_1(): # ... load your first model return model_1 def load_model_2(): # ... load your second model return model_2 def load_model_3(): # ... load your third model return model_3 def generate_caption(model, image): # ... perform inference with your model return caption models = [load_model_1(), load_model_2(), load_model_3()] with gr.Blocks() as demo: with gr.Row(): image = gr.Image(label="Upload Chest X-ray") with gr.Row(): gr.Radio(["Model 1", "Model 2", "Model 3"], label="Select Model") with gr.Row(): caption = gr.Textbox(label="Generated Caption") image.change( fn=generate_caption, inputs=[image, gr.inputs.Radio], outputs=caption ) demo.launch()