andy-wyx commited on
Commit
7a2259a
·
1 Parent(s): d3d5e8c

change class to plant family

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. closest_sample.py +1 -1
app.py CHANGED
@@ -349,10 +349,10 @@ with gr.Blocks(theme='sudeepshouche/minimalist') as demo:
349
  )
350
  with gr.Row():
351
  with gr.Column(scale=1):
352
- class_predicted = gr.Label(label='Class Predicted',num_top_classes=10)
353
  with gr.Column(scale=4):
354
  with gr.Accordion("Explanations "):
355
- gr.Markdown("Computing Explanations from the model")
356
  with gr.Column():
357
  with gr.Row():
358
 
@@ -391,7 +391,7 @@ with gr.Blocks(theme='sudeepshouche/minimalist') as demo:
391
  # closest_image_4 = gr.Image(label='Fifth Closest Image',image_mode='contain',width=200, height=200)
392
  # find_closest_btn = gr.Button("Find Closest Images")
393
  with gr.Accordion('Closest Fossil Images'):
394
- gr.Markdown("Finding the closest images in the dataset")
395
 
396
  with gr.Row():
397
  closest_gallery = gr.Gallery(label="Closest Images", show_label=False,elem_id="gallery",columns=[5], rows=[1],height='auto', allow_preview=True, preview=None)
@@ -430,7 +430,7 @@ with gr.Blocks(theme='sudeepshouche/minimalist') as demo:
430
  #labels_markdown = f"<div style='width: 100%; text-align: center;'>{labels_html}</div>"
431
  image_caption=[]
432
  for i in range(5):
433
- image_caption.append((images[i],"Predicted Class "+str(i)+": "+labels[i]))
434
  return image_caption
435
 
436
  generate_explanations.click(fn=update_exp_outputs, inputs=[original_image,model_name,explain_method,sampling_size], outputs=[exp_gallery])
 
349
  )
350
  with gr.Row():
351
  with gr.Column(scale=1):
352
+ class_predicted = gr.Label(label='Plant Family Predicted',num_top_classes=10)
353
  with gr.Column(scale=4):
354
  with gr.Accordion("Explanations "):
355
+ gr.Markdown("Computing Explanations from the model for Top 5 Predicted Plant Families")
356
  with gr.Column():
357
  with gr.Row():
358
 
 
391
  # closest_image_4 = gr.Image(label='Fifth Closest Image',image_mode='contain',width=200, height=200)
392
  # find_closest_btn = gr.Button("Find Closest Images")
393
  with gr.Accordion('Closest Fossil Images'):
394
+ gr.Markdown("Finding 5 closest images in the dataset")
395
 
396
  with gr.Row():
397
  closest_gallery = gr.Gallery(label="Closest Images", show_label=False,elem_id="gallery",columns=[5], rows=[1],height='auto', allow_preview=True, preview=None)
 
430
  #labels_markdown = f"<div style='width: 100%; text-align: center;'>{labels_html}</div>"
431
  image_caption=[]
432
  for i in range(5):
433
+ image_caption.append((images[i],"Predicted Plant Family "+str(i)+": "+labels[i]))
434
  return image_caption
435
 
436
  generate_explanations.click(fn=update_exp_outputs, inputs=[original_image,model_name,explain_method,sampling_size], outputs=[exp_gallery])
closest_sample.py CHANGED
@@ -130,7 +130,7 @@ def get_diagram(embedding,top_k):
130
  ax.bar(sorted_classes, sorted_frequencies,color=colors)
131
  ax.set_xlabel('Class Label')
132
  ax.set_ylabel('Frequency')
133
- ax.set_title('Distribution of '+str(top_k) +' Closest Sample Classes')
134
  ax.set_xticklabels(class_counts.keys(), rotation=45, ha='right')
135
 
136
  # Save the diagram to a file
 
130
  ax.bar(sorted_classes, sorted_frequencies,color=colors)
131
  ax.set_xlabel('Class Label')
132
  ax.set_ylabel('Frequency')
133
+ ax.set_title('Distribution of Plant Family of '+str(top_k) +' Closest Samples')
134
  ax.set_xticklabels(class_counts.keys(), rotation=45, ha='right')
135
 
136
  # Save the diagram to a file