Jyothirmai commited on
Commit
5d8bab6
1 Parent(s): a578925

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -29,11 +29,12 @@ sample_images = [
29
  with gr.Blocks() as demo:
30
  with gr.Row():
31
  image = gr.Image(label="Upload Chest X-ray")
32
- sample_images = gr.Image(sample_images, label="Sample Images") # Updated Component Name
33
  with gr.Row():
34
  model_choice = gr.Radio(["CLIP-GPT2", "ViT-GPT2", "ViT-CoAttention"], label="Select Model")
35
  with gr.Row():
36
  caption = gr.Textbox(label="Generated Caption")
 
37
  def predict(img, model_name):
38
  if model_name == "CLIP-GPT2":
39
  return generate_caption_clipgpt(img)
@@ -43,6 +44,6 @@ with gr.Blocks() as demo:
43
 
44
  # Handle changes for both uploaded and sample images
45
  image.change(predict, [image, model_choice], caption)
46
- sample_image_gallery.change(predict, [sample_image_gallery, model_choice], caption)
47
 
48
  demo.launch()
 
29
  with gr.Blocks() as demo:
30
  with gr.Row():
31
  image = gr.Image(label="Upload Chest X-ray")
32
+ sample_images_gallery = gr.Gallery(sample_images, label="Sample Images")
33
  with gr.Row():
34
  model_choice = gr.Radio(["CLIP-GPT2", "ViT-GPT2", "ViT-CoAttention"], label="Select Model")
35
  with gr.Row():
36
  caption = gr.Textbox(label="Generated Caption")
37
+
38
  def predict(img, model_name):
39
  if model_name == "CLIP-GPT2":
40
  return generate_caption_clipgpt(img)
 
44
 
45
  # Handle changes for both uploaded and sample images
46
  image.change(predict, [image, model_choice], caption)
47
+ sample_images_gallery.change(predict, [sample_images_gallery, model_choice], caption)
48
 
49
  demo.launch()