andy-wyx commited on
Commit
3807486
·
1 Parent(s): 947ec65

change output type

Browse files
Files changed (1) hide show
  1. app.py +31 -22
app.py CHANGED
@@ -229,30 +229,39 @@ def preprocess_image(image, output_size=(300, 300)):
229
  def update_display(image):
230
  processed_image = preprocess_image(image)
231
  instruction = "Image ready. Please switch to the 'Specimen Workbench' tab to check out further analysis and outputs."
232
- model_name = gr.Dropdown(
233
- ["Mummified 170", "Rock 170","Fossils 142","Fossils new"],
234
- multiselect=False,
235
- value="Fossils new", # default option
236
- label="Model",
237
- interactive=True,
238
- info="Choose the model you'd like to use"
239
- )
240
- explain_method = gr.Dropdown(
241
- ["Sobol", "HSIC","Rise","Saliency"],
242
- multiselect=False,
243
- value="Rise", # default option
244
- label="Explain method",
245
- interactive=True,
246
- info="Choose one method to explain the model"
247
- )
248
- sampling_size = gr.Slider(1, 5000, value=2000, label="Sampling Size in Rise",interactive=True,visible=True,
249
- info="Choose between 1 and 5000")
 
 
 
 
 
250
 
251
- top_k = gr.Slider(10,200,value=50,label="Number of Closest Samples for Distribution Chart",interactive=True,info="Choose between 10 and 200")
 
252
  class_predicted = "Class Predicted" # gr.Label(label='Class Predicted',num_top_classes=10)
253
- exp_gallery = gr.Gallery(label="Explanation Heatmaps for top 5 predicted classes", show_label=False,elem_id="gallery",columns=[5], rows=[1],height='auto', allow_preview=True, preview=None)
254
- closest_gallery = gr.Gallery(label="Closest Images", show_label=False,elem_id="gallery",columns=[5], rows=[1],height='auto', allow_preview=True, preview=None)
255
- diagram= gr.Image(label = 'Bar Chart')
 
 
 
256
  return processed_image,processed_image,instruction,model_name,explain_method,sampling_size,top_k,exp_gallery,closest_gallery,diagram
257
  def update_slider_visibility(explain_method):
258
  bool = explain_method=="Rise"
 
229
  def update_display(image):
230
  processed_image = preprocess_image(image)
231
  instruction = "Image ready. Please switch to the 'Specimen Workbench' tab to check out further analysis and outputs."
232
+ model_name = "Fossils new"
233
+
234
+ # gr.Dropdown(
235
+ # ["Mummified 170", "Rock 170","Fossils 142","Fossils new"],
236
+ # multiselect=False,
237
+ # value="Fossils new", # default option
238
+ # label="Model",
239
+ # interactive=True,
240
+ # info="Choose the model you'd like to use"
241
+ # )
242
+ explain_method = "Rise"
243
+
244
+ # gr.Dropdown(
245
+ # ["Sobol", "HSIC","Rise","Saliency"],
246
+ # multiselect=False,
247
+ # value="Rise", # default option
248
+ # label="Explain method",
249
+ # interactive=True,
250
+ # info="Choose one method to explain the model"
251
+ # )
252
+ sampling_size = 2000
253
+ # gr.Slider(1, 5000, value=2000, label="Sampling Size in Rise",interactive=True,visible=True,
254
+ # info="Choose between 1 and 5000")
255
 
256
+ top_k = 50
257
+ # gr.Slider(10,200,value=50,label="Number of Closest Samples for Distribution Chart",interactive=True,info="Choose between 10 and 200")
258
  class_predicted = "Class Predicted" # gr.Label(label='Class Predicted',num_top_classes=10)
259
+ exp_gallery = []
260
+ # gr.Gallery(label="Explanation Heatmaps for top 5 predicted classes", show_label=False,elem_id="gallery",columns=[5], rows=[1],height='auto', allow_preview=True, preview=None)
261
+ closest_gallery = []
262
+ # gr.Gallery(label="Closest Images", show_label=False,elem_id="gallery",columns=[5], rows=[1],height='auto', allow_preview=True, preview=None)
263
+ diagram= ""
264
+ # gr.Image(label = 'Bar Chart')
265
  return processed_image,processed_image,instruction,model_name,explain_method,sampling_size,top_k,exp_gallery,closest_gallery,diagram
266
  def update_slider_visibility(explain_method):
267
  bool = explain_method=="Rise"