Jyothirmai
commited on
Commit
•
30e7fb3
1
Parent(s):
4952e85
Update app.py
Browse files
app.py
CHANGED
@@ -32,14 +32,14 @@ def generate_caption_cnnrnn(image):
|
|
32 |
|
33 |
|
34 |
with gr.Row():
|
35 |
-
image = gr.Image(label="Upload Chest X-ray", type="pil", height='
|
36 |
|
37 |
|
38 |
with gr.Row():
|
39 |
with gr.Column(): # Column for dropdowns and model choice
|
40 |
max_tokens = gr.Dropdown(list(range(50, 101)), label="Max Tokens", value=75)
|
41 |
temperature = gr.Slider(0.5, 0.9, step=0.1, label="Temperature", value=0.9)
|
42 |
-
imgID = gr.Dropdown(list(range(1,
|
43 |
|
44 |
model_choice = gr.Radio(["CLIP-GPT2", "ViT-GPT2", "ViT-CoAttention", "Baseline Model CNN-RNN"], label="Select Model")
|
45 |
generate_button = gr.Button("Generate Caption")
|
@@ -67,7 +67,7 @@ def predict(img, model_name, max_tokens, temperature, imgID):
|
|
67 |
elif model_name == "ViT-CoAttention":
|
68 |
return generate_caption_vitCoAtt(img), getCaption(imgID)
|
69 |
elif model_name == "Baseline Model CNN-RNN":
|
70 |
-
img = getImageID(imgID)
|
71 |
return generate_caption_cnnrnn(img), getCaption(imgID)
|
72 |
else:
|
73 |
return "select a model","select an image"
|
|
|
32 |
|
33 |
|
34 |
with gr.Row():
|
35 |
+
image = gr.Image(label="Upload Chest X-ray", type="pil", height='50',width='50')
|
36 |
|
37 |
|
38 |
with gr.Row():
|
39 |
with gr.Column(): # Column for dropdowns and model choice
|
40 |
max_tokens = gr.Dropdown(list(range(50, 101)), label="Max Tokens", value=75)
|
41 |
temperature = gr.Slider(0.5, 0.9, step=0.1, label="Temperature", value=0.9)
|
42 |
+
imgID = gr.Dropdown(list(range(1,7)), label="Example Image Selected")
|
43 |
|
44 |
model_choice = gr.Radio(["CLIP-GPT2", "ViT-GPT2", "ViT-CoAttention", "Baseline Model CNN-RNN"], label="Select Model")
|
45 |
generate_button = gr.Button("Generate Caption")
|
|
|
67 |
elif model_name == "ViT-CoAttention":
|
68 |
return generate_caption_vitCoAtt(img), getCaption(imgID)
|
69 |
elif model_name == "Baseline Model CNN-RNN":
|
70 |
+
img = getImageID(str(imgID))
|
71 |
return generate_caption_cnnrnn(img), getCaption(imgID)
|
72 |
else:
|
73 |
return "select a model","select an image"
|