File size: 920 Bytes
7ebfeb9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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()