lime-j commited on
Commit
eff262d
·
verified ·
1 Parent(s): 7465809

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -16
app.py CHANGED
@@ -135,26 +135,21 @@ with gr.Blocks() as block_demo:
135
  # if type(choice) is not str : choice = choice.value
136
  print(choice, image, method1, method2, property, ip)
137
  send_message_to_mongodb(image, property, method1, method2, choice, ip)
 
138
  # new_image, new_method1, new_method2, new_image1, new_image2, new_property = get_random_comparison()
139
  return [
140
- # gr.Markdown("### Thanks for your submission!"),
141
- gr.Button(interactive=False),
142
- gr.Button(interactive=False),
143
- gr.Button(interactive=False),
144
- gr.Button(interactive=False),
145
- # gr.Markdown(f'Left image: {method_dict[method1]}'),
146
- # gr.Markdown(f'Right image: {method_dict[method2]}'),
147
- gr.Button(visible=False, interactive=True),
148
- # gr.Image(new_image1),
149
- # gr.Image(new_image2),
150
- # f'### Submit your choice for **{new_property}**'
151
  ]
152
 
153
- l_butt.click(fn=update_interface, inputs=[method1_state, image_state, method1_state, method2_state, property_state, ip_state], outputs=[l_butt, r_butt, both_good, both_bad, refresh_butt], js="sleep(1);window.location.reload()")
154
- r_butt.click(fn=update_interface, inputs=[method2_state, image_state, method1_state, method2_state, property_state, ip_state], outputs=[l_butt, r_butt, both_good, both_bad, refresh_butt],js="sleep(1);window.location.reload()")
155
- both_good.click(fn=update_interface, inputs=[gr.State('both_good'), image_state, method1_state, method2_state, property_state, ip_state], outputs=[l_butt, r_butt, both_good, both_bad, refresh_butt],js="sleep(1);window.location.reload()")
156
- both_bad.click(fn=update_interface, inputs=[gr.State('both_bad'), image_state, method1_state, method2_state, property_state, ip_state], outputs=[l_butt, r_butt, both_good, both_bad, refresh_butt], js="sleep(1);window.location.reload()")
157
-
 
 
 
 
158
 
159
  # refresh_butt.click(None, js="window.location.reload()")
160
 
 
135
  # if type(choice) is not str : choice = choice.value
136
  print(choice, image, method1, method2, property, ip)
137
  send_message_to_mongodb(image, property, method1, method2, choice, ip)
138
+ img1, img2, prop_text, image_state, method1_state, method2_state, property_state, img_input, ip_state = on_load()
139
  # new_image, new_method1, new_method2, new_image1, new_image2, new_property = get_random_comparison()
140
  return [
141
+ img1, img2, prop_text, image_state, method1_state, method2_state, property_state, img_input, ip_state
 
 
 
 
 
 
 
 
 
 
142
  ]
143
 
144
+ l_butt.click(fn=update_interface, inputs=[method1_state, image_state, method1_state, method2_state, property_state, ip_state],
145
+ outputs=[img1, img2, prop_text, image_state, method1_state, method2_state, property_state, img_input, ip_state])
146
+ r_butt.click(fn=update_interface, inputs=[method2_state, image_state, method1_state, method2_state, property_state, ip_state],
147
+ outputs=[img1, img2, prop_text, image_state, method1_state, method2_state, property_state, img_input, ip_state])
148
+ both_good.click(fn=update_interface, inputs=[gr.State('both_good'), image_state, method1_state, method2_state, property_state, ip_state],
149
+ outputs=[img1, img2, prop_text, image_state, method1_state, method2_state, property_state, img_input, ip_state])
150
+ both_bad.click(fn=update_interface, inputs=[gr.State('both_bad'), image_state, method1_state, method2_state, property_state, ip_state],
151
+ outputs=[img1, img2, prop_text, image_state, method1_state, method2_state, property_state, img_input, ip_state])
152
+
153
 
154
  # refresh_butt.click(None, js="window.location.reload()")
155