Spaces:
Sleeping
Sleeping
Hanxun Huang
commited on
Commit
·
ce33ad6
1
Parent(s):
3fd1891
update
Browse files- README.md +2 -2
- app.py +11 -8
- requirements.txt +2 -1
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 🌍
|
|
4 |
colorFrom: gray
|
5 |
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
@@ -18,4 +18,4 @@ short_description: XTransferBench Demo for UAP Linf
|
|
18 |
|
19 |
Demo for ICML2025 paper ["X-Transfer Attacks: Towards Super Transferable Adversarial Attacks on CLIP"](https://arxiv.org/abs/2505.05528)
|
20 |
|
21 |
-
Code: https://github.com/HanxunH/XTransferBench
|
|
|
4 |
colorFrom: gray
|
5 |
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.44.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
|
|
18 |
|
19 |
Demo for ICML2025 paper ["X-Transfer Attacks: Towards Super Transferable Adversarial Attacks on CLIP"](https://arxiv.org/abs/2505.05528)
|
20 |
|
21 |
+
Code: https://github.com/HanxunH/XTransferBench
|
app.py
CHANGED
@@ -17,25 +17,28 @@ def XTransferAttack(image, attacker_name, epsilon):
|
|
17 |
adv_image= adv_image_resized.resize((original_image.size[0], original_image.size[1]))
|
18 |
return adv_image_resized, adv_image
|
19 |
|
20 |
-
|
21 |
demo = gr.Interface(
|
22 |
fn=XTransferAttack,
|
23 |
inputs=[
|
24 |
gr.Image(type="pil", label="Input Image",),
|
25 |
gr.Dropdown(
|
26 |
-
XTransferBench.zoo.list_attacker(threat_model='linf_non_targeted'),
|
27 |
-
|
28 |
-
|
|
|
29 |
),
|
30 |
gr.Slider(
|
31 |
-
minimum=0, maximum=255, step=1, value=12,
|
32 |
-
|
33 |
-
|
|
|
34 |
],
|
35 |
outputs=[
|
36 |
gr.Image(type="pil", label="Adversarial Image (Resized)"),
|
37 |
gr.Image(type="pil", label="Adversarial Image (Original Size)"),
|
38 |
-
]
|
|
|
|
|
39 |
)
|
40 |
|
41 |
demo.launch(share=True)
|
|
|
17 |
adv_image= adv_image_resized.resize((original_image.size[0], original_image.size[1]))
|
18 |
return adv_image_resized, adv_image
|
19 |
|
|
|
20 |
demo = gr.Interface(
|
21 |
fn=XTransferAttack,
|
22 |
inputs=[
|
23 |
gr.Image(type="pil", label="Input Image",),
|
24 |
gr.Dropdown(
|
25 |
+
choices=XTransferBench.zoo.list_attacker(threat_model='linf_non_targeted'),
|
26 |
+
value="xtransfer_large_linf_eps12_non_targeted",
|
27 |
+
label="Attacker",
|
28 |
+
info="Select an attacker method."
|
29 |
),
|
30 |
gr.Slider(
|
31 |
+
minimum=0, maximum=255, step=1, value=12,
|
32 |
+
label="Epsilon",
|
33 |
+
info="Perturbation strength (0-255)"
|
34 |
+
)
|
35 |
],
|
36 |
outputs=[
|
37 |
gr.Image(type="pil", label="Adversarial Image (Resized)"),
|
38 |
gr.Image(type="pil", label="Adversarial Image (Original Size)"),
|
39 |
+
],
|
40 |
+
title="XTransferBench Adversarial Attack Demo",
|
41 |
+
description="Visualize adversarial examples on images using transfer-based attacks from the XTransferBench library.",
|
42 |
)
|
43 |
|
44 |
demo.launch(share=True)
|
requirements.txt
CHANGED
@@ -2,4 +2,5 @@ torch
|
|
2 |
torchvision
|
3 |
huggingface-hub
|
4 |
safetensors
|
5 |
-
transformers
|
|
|
|
2 |
torchvision
|
3 |
huggingface-hub
|
4 |
safetensors
|
5 |
+
transformers
|
6 |
+
XTransferBench
|