Spaces:
Sleeping
Sleeping
demo update
Browse files- .gitignore +2 -1
- app.py +8 -4
.gitignore
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
.tmp
|
2 |
-
__pycache__
|
|
|
|
1 |
.tmp
|
2 |
+
__pycache__
|
3 |
+
.vscode
|
app.py
CHANGED
@@ -420,7 +420,8 @@ class ExplainerCheckboxGroup(Component):
|
|
420 |
bttns += [gr.Button(value="Optimize", size="sm", variant="primary")] * len(self.explainer_objs)
|
421 |
|
422 |
for exp in self.explainer_objs:
|
423 |
-
|
|
|
424 |
if hasattr(exp, "optimal_exp_id"):
|
425 |
self.update_check(exp.optimal_exp_id, False)
|
426 |
return checkboxes + bttns
|
@@ -436,10 +437,11 @@ class ExplainerCheckboxGroup(Component):
|
|
436 |
|
437 |
def show(self):
|
438 |
cnt = 0
|
|
|
439 |
with gr.Accordion("Explainers", open=True):
|
440 |
while cnt * PLOT_PER_LINE < len(self.explainer_names):
|
441 |
with gr.Row():
|
442 |
-
for info in
|
443 |
explainer_obj = ExplainerCheckbox(info['nm'], self, self.experiment, self.gallery)
|
444 |
self.explainer_objs.append(explainer_obj)
|
445 |
explainer_obj.show()
|
@@ -511,7 +513,8 @@ class ExplainerCheckbox(Component):
|
|
511 |
raise ValueError("Optimal explainer id is not found.")
|
512 |
|
513 |
def show(self):
|
514 |
-
|
|
|
515 |
checked = next(filter(lambda x: x['nm'] == self.explainer_name, self.groups.info))['checked']
|
516 |
self.default_check = gr.Checkbox(label="Default Parameter", value=checked, interactive=True)
|
517 |
self.opt_check = gr.Checkbox(label="Optimized Parameter (Not Optimal)", interactive=False)
|
@@ -671,4 +674,5 @@ experiments['experiment2'] = {
|
|
671 |
|
672 |
app = ImageClsApp(experiments)
|
673 |
demo = app.launch()
|
674 |
-
demo.launch(favicon_path="data/static/XAI-Top-PnP.svg", share=True)
|
|
|
|
420 |
bttns += [gr.Button(value="Optimize", size="sm", variant="primary")] * len(self.explainer_objs)
|
421 |
|
422 |
for exp in self.explainer_objs:
|
423 |
+
val = exp.explainer_name in DEFAULT_EXPLAINER
|
424 |
+
self.update_check(exp.default_exp_id, val)
|
425 |
if hasattr(exp, "optimal_exp_id"):
|
426 |
self.update_check(exp.optimal_exp_id, False)
|
427 |
return checkboxes + bttns
|
|
|
437 |
|
438 |
def show(self):
|
439 |
cnt = 0
|
440 |
+
sorted_info = sorted(self.info, key=lambda x: (x['nm'] not in DEFAULT_EXPLAINER, x['nm']))
|
441 |
with gr.Accordion("Explainers", open=True):
|
442 |
while cnt * PLOT_PER_LINE < len(self.explainer_names):
|
443 |
with gr.Row():
|
444 |
+
for info in sorted_info[cnt*PLOT_PER_LINE:(cnt+1)*PLOT_PER_LINE]:
|
445 |
explainer_obj = ExplainerCheckbox(info['nm'], self, self.experiment, self.gallery)
|
446 |
self.explainer_objs.append(explainer_obj)
|
447 |
explainer_obj.show()
|
|
|
513 |
raise ValueError("Optimal explainer id is not found.")
|
514 |
|
515 |
def show(self):
|
516 |
+
val = self.explainer_name in DEFAULT_EXPLAINER
|
517 |
+
with gr.Accordion(self.explainer_name, open=val):
|
518 |
checked = next(filter(lambda x: x['nm'] == self.explainer_name, self.groups.info))['checked']
|
519 |
self.default_check = gr.Checkbox(label="Default Parameter", value=checked, interactive=True)
|
520 |
self.opt_check = gr.Checkbox(label="Optimized Parameter (Not Optimal)", interactive=False)
|
|
|
674 |
|
675 |
app = ImageClsApp(experiments)
|
676 |
demo = app.launch()
|
677 |
+
demo.launch(favicon_path="data/static/XAI-Top-PnP.svg", share=True)
|
678 |
+
# demo.launch(favicon_path="data/static/XAI-Top-PnP.svg")
|