Update app.py
Browse files
app.py
CHANGED
|
@@ -218,18 +218,18 @@ if __name__ == "__main__":
|
|
| 218 |
value="TextFooler",
|
| 219 |
label="Choose an Adversarial Attacker for generating an adversarial example to attack the model.",
|
| 220 |
)
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
|
| 234 |
msg_text = gr.Textbox(
|
| 235 |
label="Message",
|
|
@@ -318,8 +318,7 @@ if __name__ == "__main__":
|
|
| 318 |
# Bind functions to buttons
|
| 319 |
button_gen.click(
|
| 320 |
fn=run_demo,
|
| 321 |
-
|
| 322 |
-
inputs=[input_dataset, input_attacker, None, None],
|
| 323 |
outputs=[
|
| 324 |
output_original_example,
|
| 325 |
output_original_label,
|
|
|
|
| 218 |
value="TextFooler",
|
| 219 |
label="Choose an Adversarial Attacker for generating an adversarial example to attack the model.",
|
| 220 |
)
|
| 221 |
+
with gr.Group(visible=False):
|
| 222 |
+
|
| 223 |
+
with gr.Row():
|
| 224 |
+
input_sentence = gr.Textbox(
|
| 225 |
+
placeholder="Input a natural example...",
|
| 226 |
+
label="Alternatively, input a natural example and its original label (from above datasets) to generate an adversarial example.",
|
| 227 |
+
)
|
| 228 |
+
input_label = gr.Textbox(
|
| 229 |
+
placeholder="Original label, (must be a integer, because we use digits to represent labels in training)", label="Original Label"
|
| 230 |
+
)
|
| 231 |
+
gr.Markdown(
|
| 232 |
+
"<h3 align='center'>To input an example, please select a dataset which the example belongs to or resembles.</h2>")
|
| 233 |
|
| 234 |
msg_text = gr.Textbox(
|
| 235 |
label="Message",
|
|
|
|
| 318 |
# Bind functions to buttons
|
| 319 |
button_gen.click(
|
| 320 |
fn=run_demo,
|
| 321 |
+
inputs=[input_dataset, input_attacker, input_sentence, input_label],
|
|
|
|
| 322 |
outputs=[
|
| 323 |
output_original_example,
|
| 324 |
output_original_label,
|