DamonDemon
commited on
Commit
•
761fb85
1
Parent(s):
4b3f8ad
refine
Browse files- app.py +79 -19
- src/about.py +2 -2
app.py
CHANGED
@@ -183,7 +183,7 @@ with demo:
|
|
183 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="reference-text")
|
184 |
|
185 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
186 |
-
with gr.TabItem("
|
187 |
files = ['nudity','vangogh', 'church','garbage','parachute','tench']
|
188 |
with gr.Row():
|
189 |
with gr.Column():
|
@@ -202,23 +202,9 @@ with demo:
|
|
202 |
)
|
203 |
|
204 |
for i in range(len(files)):
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
# elif files[i] == 'garbage':
|
209 |
-
# name = "### [Unlearned Objects] "+" Garbage"
|
210 |
-
# csv_path = './assets/'+files[i]+'.csv'
|
211 |
-
# elif files[i] == 'tench':
|
212 |
-
# name = "### [Unlearned Objects] "+" Tench"
|
213 |
-
# csv_path = './assets/'+files[i]+'.csv'
|
214 |
-
elif files[i] == 'parachute':
|
215 |
-
name = "### [Unlearned Objects] "+" Parachute"
|
216 |
-
csv_path = './assets/'+files[i]+'.csv'
|
217 |
-
elif files[i] == 'vangogh':
|
218 |
-
name = "### [Unlearned Style] "+" Van Gogh"
|
219 |
-
csv_path = './assets/'+files[i]+'.csv'
|
220 |
-
elif files[i] == 'nudity':
|
221 |
-
name = "### Unlearned Concepts "+" Nudity"
|
222 |
csv_path = './assets/'+files[i]+'.csv'
|
223 |
# elif files[i] == 'violence':
|
224 |
# name = "### Unlearned Concepts "+" Violence"
|
@@ -290,9 +276,83 @@ with demo:
|
|
290 |
for i in range(len(files)):
|
291 |
|
292 |
if files[i] == 'vangogh':
|
293 |
-
name = "### [Unlearned Style] "+" Van Gogh"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
csv_path = './assets/'+files[i]+'.csv'
|
295 |
|
|
|
296 |
gr.Markdown(name)
|
297 |
df_results = load_data(csv_path)
|
298 |
df_results_init = df_results.copy()[show_columns]
|
|
|
183 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="reference-text")
|
184 |
|
185 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
186 |
+
with gr.TabItem("NSFW", elem_id="UnlearnDiffAtk-benchmark-tab-table", id=0):
|
187 |
files = ['nudity','vangogh', 'church','garbage','parachute','tench']
|
188 |
with gr.Row():
|
189 |
with gr.Column():
|
|
|
202 |
)
|
203 |
|
204 |
for i in range(len(files)):
|
205 |
+
|
206 |
+
if files[i] == 'nudity':
|
207 |
+
name = "### [Unlearned Concept]: "+" Nudity"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
csv_path = './assets/'+files[i]+'.csv'
|
209 |
# elif files[i] == 'violence':
|
210 |
# name = "### Unlearned Concepts "+" Violence"
|
|
|
276 |
for i in range(len(files)):
|
277 |
|
278 |
if files[i] == 'vangogh':
|
279 |
+
name = "### [Unlearned Style]: "+" Van Gogh"
|
280 |
+
csv_path = './assets/'+files[i]+'.csv'
|
281 |
+
|
282 |
+
gr.Markdown(name)
|
283 |
+
df_results = load_data(csv_path)
|
284 |
+
df_results_init = df_results.copy()[show_columns]
|
285 |
+
leaderboard_table = gr.components.Dataframe(
|
286 |
+
value = df_results,
|
287 |
+
datatype = TYPES,
|
288 |
+
elem_id = "leaderboard-table",
|
289 |
+
interactive = False,
|
290 |
+
visible=True,
|
291 |
+
)
|
292 |
+
|
293 |
+
|
294 |
+
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|
295 |
+
value=df_results_init,
|
296 |
+
# value=df_results,
|
297 |
+
interactive=False,
|
298 |
+
visible=False,
|
299 |
+
)
|
300 |
+
|
301 |
+
search_bar.submit(
|
302 |
+
update_table,
|
303 |
+
[
|
304 |
+
|
305 |
+
hidden_leaderboard_table_for_search,
|
306 |
+
model1_column,
|
307 |
+
search_bar,
|
308 |
+
],
|
309 |
+
leaderboard_table,
|
310 |
+
)
|
311 |
+
|
312 |
+
for selector in [model1_column]:
|
313 |
+
selector.change(
|
314 |
+
update_table,
|
315 |
+
[
|
316 |
+
hidden_leaderboard_table_for_search,
|
317 |
+
model1_column,
|
318 |
+
search_bar,
|
319 |
+
],
|
320 |
+
leaderboard_table,
|
321 |
+
)
|
322 |
+
|
323 |
+
with gr.TabItem("Object", elem_id="UnlearnDiffAtk-benchmark-tab-table", id=2):
|
324 |
+
files = ['church','garbage','parachute','tench']
|
325 |
+
with gr.Row():
|
326 |
+
with gr.Column():
|
327 |
+
with gr.Row():
|
328 |
+
search_bar = gr.Textbox(
|
329 |
+
placeholder=" 🔍 Search for your model (separate multiple queries with `;`) and press ENTER...",
|
330 |
+
show_label=False,
|
331 |
+
elem_id="search-bar",
|
332 |
+
)
|
333 |
+
with gr.Row():
|
334 |
+
model1_column = gr.CheckboxGroup(
|
335 |
+
label="Evaluation Metrics",
|
336 |
+
choices=['Pre-ASR','Post-ASR','FID','CLIP-Score'],
|
337 |
+
interactive=True,
|
338 |
+
elem_id="column-select",
|
339 |
+
)
|
340 |
+
|
341 |
+
for i in range(len(files)):
|
342 |
+
if files[i] == "church":
|
343 |
+
name = "### [Unlearned Object]: "+" Church"
|
344 |
+
csv_path = './assets/'+files[i]+'.csv'
|
345 |
+
elif files[i] == 'garbage':
|
346 |
+
name = "### [Unlearned Object]: "+" Garbage"
|
347 |
+
csv_path = './assets/'+files[i]+'.csv'
|
348 |
+
elif files[i] == 'tench':
|
349 |
+
name = "### [Unlearned Object]: "+" Tench"
|
350 |
+
csv_path = './assets/'+files[i]+'.csv'
|
351 |
+
elif files[i] == 'parachute':
|
352 |
+
name = "### [Unlearned Object]: "+" Parachute"
|
353 |
csv_path = './assets/'+files[i]+'.csv'
|
354 |
|
355 |
+
|
356 |
gr.Markdown(name)
|
357 |
df_results = load_data(csv_path)
|
358 |
df_results_init = df_results.copy()[show_columns]
|
src/about.py
CHANGED
@@ -21,10 +21,10 @@ NUM_FEWSHOT = 0 # Change with your few shot
|
|
21 |
|
22 |
|
23 |
# Your leaderboard name
|
24 |
-
TITLE = """<h1 align="center" id="space-title">UnlearnDiffAtk Benchmark</h1>"""
|
25 |
|
26 |
# subtitle
|
27 |
-
SUB_TITLE = """<h2 align="center" id="space-title">Effective and efficient adversarial prompt generation approach for diffusion
|
28 |
|
29 |
# What does your leaderboard evaluate?
|
30 |
INTRODUCTION_TEXT = """
|
|
|
21 |
|
22 |
|
23 |
# Your leaderboard name
|
24 |
+
TITLE = """<h1 align="center" id="space-title">UnlearnDiffAtk: Unlearned Diffusion Model Benchmark</h1>"""
|
25 |
|
26 |
# subtitle
|
27 |
+
SUB_TITLE = """<h2 align="center" id="space-title">Effective and efficient adversarial prompt generation approach for unlearned diffusion model evaluations.</h2>"""
|
28 |
|
29 |
# What does your leaderboard evaluate?
|
30 |
INTRODUCTION_TEXT = """
|