Update app.py
Browse files
app.py
CHANGED
@@ -113,7 +113,7 @@ def generate_adversarial_example(dataset, attacker, text=None, label=None):
|
|
113 |
classification_df["is_repaired"] = result["is_fixed"]
|
114 |
classification_df["pred_label"] = result["label"]
|
115 |
classification_df["confidence"] = round(result["confidence"], 3)
|
116 |
-
classification_df["is_correct"] = str(result["
|
117 |
|
118 |
advdetection_df = {}
|
119 |
if result["is_adv_label"] != "0":
|
@@ -143,6 +143,7 @@ def generate_adversarial_example(dataset, attacker, text=None, label=None):
|
|
143 |
attack_result.perturbed_result.output,
|
144 |
pd.DataFrame(classification_df, index=[0]),
|
145 |
pd.DataFrame(advdetection_df, index=[0]),
|
|
|
146 |
)
|
147 |
|
148 |
|
@@ -210,7 +211,7 @@ if __name__ == "__main__":
|
|
210 |
with gr.Group():
|
211 |
with gr.Row():
|
212 |
input_dataset = gr.Radio(
|
213 |
-
choices=["SST2", "Amazon", "AGNews10K"],
|
214 |
value="SST2",
|
215 |
label="Select a testing dataset and an adversarial attacker to generate an adversarial example.",
|
216 |
)
|
|
|
113 |
classification_df["is_repaired"] = result["is_fixed"]
|
114 |
classification_df["pred_label"] = result["label"]
|
115 |
classification_df["confidence"] = round(result["confidence"], 3)
|
116 |
+
classification_df["is_correct"] = str(result["label"]) == str(label)
|
117 |
|
118 |
advdetection_df = {}
|
119 |
if result["is_adv_label"] != "0":
|
|
|
143 |
attack_result.perturbed_result.output,
|
144 |
pd.DataFrame(classification_df, index=[0]),
|
145 |
pd.DataFrame(advdetection_df, index=[0]),
|
146 |
+
''
|
147 |
)
|
148 |
|
149 |
|
|
|
211 |
with gr.Group():
|
212 |
with gr.Row():
|
213 |
input_dataset = gr.Radio(
|
214 |
+
choices=["SST2", "Amazon", "Yahoo", "AGNews10K"],
|
215 |
value="SST2",
|
216 |
label="Select a testing dataset and an adversarial attacker to generate an adversarial example.",
|
217 |
)
|