Vihang28 commited on
Commit
5557f0c
·
verified ·
1 Parent(s): 8065f6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -124,9 +124,28 @@ with gr.Blocks(theme=gr.themes.Glass(primary_hue=gr.themes.colors.stone)) as dem
124
  # output_img_thumb = gr.Textbox(label="Image names")
125
  with gr.Row():
126
  with gr.Column():
 
127
  image_name = gr.Textbox(label="""
128
  Note: To check the image provide single name and to compare provide both the image names separated by a comma(,)
129
  """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  show_button = gr.Button(value="Show Images")
131
  output_img = gr.Image(type="filepath",label="Selected Graph")
132
 
 
124
  # output_img_thumb = gr.Textbox(label="Image names")
125
  with gr.Row():
126
  with gr.Column():
127
+
128
  image_name = gr.Textbox(label="""
129
  Note: To check the image provide single name and to compare provide both the image names separated by a comma(,)
130
  """)
131
+ image_name_lst = []
132
+ image_id_lst = []
133
+ image_name_str = ''
134
+ def get_select_index(evt: gr.SelectData):
135
+ image_name = evt.value['image']['path']
136
+ image_name_lst = image_name.split('/')
137
+ if len(image_id_lst) >= 2 :
138
+ image_id_lst[0] = image_id_lst[1]
139
+ image_id_lst[1] = image_name_lst[4]
140
+ else:
141
+ image_id_lst.append(image_name_lst[4])
142
+ if len(image_id_lst) == 1 :
143
+ image_name_str = image_id_lst[0]
144
+ return image_name_str
145
+ else:
146
+ image_name_str = image_id_lst[0] + ',' + image_id_lst[1]
147
+ return image_name_str
148
+ img_gallery.select(get_select_index, None, image_name)
149
  show_button = gr.Button(value="Show Images")
150
  output_img = gr.Image(type="filepath",label="Selected Graph")
151