anhng8 commited on
Commit
41d2115
1 Parent(s): 006180e

Update app.py

Browse files

Updated demo descriptor. Change to extra class

Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -388,13 +388,13 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="PEEB") as demo:
388
 
389
  with gr.Column():
390
  title_text = gr.Markdown("# A classifier with Part-based Explainable and Editable Bottleneck (PEEB) | Demo")
391
- gr.Markdown("Here is a PEEB classifier pre-trained on Bird-11K and finetuned on CUB-200 (see our [NAACL 2024 paper](https://arxiv.org/abs/2403.05297) and [code](https://github.com/anguyen8/peeb/tree/inspect_ddp)).\n The demo shows how one runs PEEB on an existing image and edit descriptors to modify the classifier (without any re-training).")
392
  gr.Markdown(
393
  """
394
  Steps:
395
  1. **Select an image**. Then, PEEB will show its grounded explanations and the top-1 predicted label with associated softmax confidence score.
396
  2. **Hover mouse over text descriptors** to see the corresponding region used to match to each text descriptor.
397
- 3. **Edit the text under [Custom Descriptions]()** which correspond to one extra, new class (i.e. 200+1 = 201). Further editing will overwrite this class' descriptors.
398
  4. **Click on Predict** to see the grounded explanations and the top-1 label for the newly modified CUB-201 classifier.
399
  """
400
  )
@@ -404,7 +404,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="PEEB") as demo:
404
 
405
  gr.Markdown("## Select an image to start!")
406
  image_gallery = gr.Gallery(value=IMAGE_GALLERY, label=None, preview=False, allow_preview=False, columns=10, height=250)
407
- gr.Markdown("### Custom descriptions: \n The first row should be **class name: {some name};**, the name of your 201th class. \n For the 12 part descriptors, please use **;** to separate the descriptions for each part, and use the format **{part name}: {descriptions}**. \n Note: you can delete a row for some part (e.g. *nape*) completely and that part will be removed from all 201 classes in the classifier.")
408
 
409
  with gr.Row():
410
  with gr.Column():
@@ -415,14 +415,14 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="PEEB") as demo:
415
  with gr.Row():
416
  # xclip_predict_button = gr.Button(label="Predict", value="Predict")
417
  xclip_predict_button = gr.Button(value="Predict")
418
- xclip_pred_label = gr.Markdown("### PEEB:")
419
  xclip_explanation = gr.HTML()
420
 
421
  with gr.Column():
422
  # xclip_edit_button = gr.Button(label="Edit", value="Reset Descriptions")
423
  xclip_edit_button = gr.Button(value="Reset Descriptions")
424
  custom_pred_label = gr.Markdown(
425
- "### Custom Descriptions:"
426
  )
427
  xclip_textbox = gr.Textbox(lines=12, placeholder="Edit the descriptions here", visible=False)
428
  # ai_explanation = gr.Image(type="numpy", visible=True, show_label=False, height=500)
 
388
 
389
  with gr.Column():
390
  title_text = gr.Markdown("# A classifier with Part-based Explainable and Editable Bottleneck (PEEB) | Demo")
391
+ gr.Markdown("Here is a PEEB bird classifier pre-trained on Bird-11K and finetuned on CUB-200 (see our [NAACL 2024 paper](https://arxiv.org/abs/2403.05297) and [code](https://github.com/anguyen8/peeb/tree/inspect_ddp)).\n This demo shows how to run PEEB on an existing image and edit descriptors to update the classifier to detect one new bird species (without any re-training).")
392
  gr.Markdown(
393
  """
394
  Steps:
395
  1. **Select an image**. Then, PEEB will show its grounded explanations and the top-1 predicted label with associated softmax confidence score.
396
  2. **Hover mouse over text descriptors** to see the corresponding region used to match to each text descriptor.
397
+ 3. **Edit the text under [Extra class]()** which correspond to one extra, new class (i.e. 200+1 = 201). Further editing will overwrite this class' descriptors.
398
  4. **Click on Predict** to see the grounded explanations and the top-1 label for the newly modified CUB-201 classifier.
399
  """
400
  )
 
404
 
405
  gr.Markdown("## Select an image to start!")
406
  image_gallery = gr.Gallery(value=IMAGE_GALLERY, label=None, preview=False, allow_preview=False, columns=10, height=250)
407
+ gr.Markdown("### Extra-class descriptors: \n The first row should be **class name: {some name};**, the name of your 201th class. \n For the 12 part descriptors, please use **;** to separate the descriptions for each part, and use the format **{part name}: {descriptions}**. \n Note: you can delete a row for some part (e.g. *nape*) completely and that part will be removed from all 201 classes in the classifier.")
408
 
409
  with gr.Row():
410
  with gr.Column():
 
415
  with gr.Row():
416
  # xclip_predict_button = gr.Button(label="Predict", value="Predict")
417
  xclip_predict_button = gr.Button(value="Predict")
418
+ xclip_pred_label = gr.Markdown("### Top-1 class:")
419
  xclip_explanation = gr.HTML()
420
 
421
  with gr.Column():
422
  # xclip_edit_button = gr.Button(label="Edit", value="Reset Descriptions")
423
  xclip_edit_button = gr.Button(value="Reset Descriptions")
424
  custom_pred_label = gr.Markdown(
425
+ "### Extra class:"
426
  )
427
  xclip_textbox = gr.Textbox(lines=12, placeholder="Edit the descriptions here", visible=False)
428
  # ai_explanation = gr.Image(type="numpy", visible=True, show_label=False, height=500)