Kieran Fraser commited on
Commit
66b3882
·
1 Parent(s): 8dcffda

Update evaluate button and spacing

Browse files

Signed-off-by: Kieran Fraser <[email protected]>

Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -229,13 +229,13 @@ def show_params(type):
229
  return gr.Column(visible=True)
230
  return gr.Column(visible=False)
231
 
232
- head_script = '''
233
  <script async defer src="https://buttons.github.io/buttons.js"></script>
234
  '''
235
 
236
  # e.g. To use a local alternative theme: carbon_theme = Carbon()
237
  carbon_theme = Carbon()
238
- with gr.Blocks(css=css, theme='Tshackelton/IBMPlex-DenseReadable') as demo:
239
  import art
240
  text = art.__version__
241
 
@@ -258,6 +258,10 @@ with gr.Blocks(css=css, theme='Tshackelton/IBMPlex-DenseReadable') as demo:
258
  target="blank_">here</a>. To dive further into poisoning attacks with Hugging Face and ART, check out our
259
  <a href="https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/main/notebooks/hugging_face_poisoning.ipynb"
260
  target="_blank">notebook</a>. Also feel free to contribute and give our repo a ⭐.</i></p>''')
 
 
 
 
261
 
262
  gr.Markdown('''<hr/>''')
263
 
@@ -294,7 +298,7 @@ with gr.Blocks(css=css, theme='Tshackelton/IBMPlex-DenseReadable') as demo:
294
  a backdoor poisoning attack against your own model and assess its performance.</p>''')
295
 
296
  with gr.Row(elem_classes="custom-text"):
297
- with gr.Column(scale=1):
298
  attack = gr.Textbox(visible=True, value="Backdoor", label="Attack", interactive=False)
299
  target_class = gr.Radio(label="Target class", info="The class you wish to force the model to predict.",
300
  choices=['church',
@@ -307,14 +311,13 @@ with gr.Blocks(css=css, theme='Tshackelton/IBMPlex-DenseReadable') as demo:
307
  'golf ball',
308
  'parachutte',], value='church')
309
  eval_btn_patch = gr.Button("Evaluate")
310
- with gr.Row(elem_classes="custom-text"):
311
  with gr.Column(scale=10):
312
  clean_gallery = gr.Gallery(label="Clean", preview=False, show_download_button=True, height=600)
313
  clean_accuracy = gr.Number(label="Clean Accuracy", precision=2)
314
  with gr.Column(scale=1, min_width='0px', elem_classes='symbols'):
315
  gr.Markdown('''➕''')
316
- with gr.Column(scale=5, elem_classes='symbols'):
317
- trigger_image = gr.Image(label="Trigger Image", value="./baby-on-board.png", interactive=False)
318
  with gr.Column(scale=1, min_width='0px'):
319
  gr.Markdown('''🟰''', elem_classes='symbols')
320
  with gr.Column(scale=10):
 
229
  return gr.Column(visible=True)
230
  return gr.Column(visible=False)
231
 
232
+ head = '''
233
  <script async defer src="https://buttons.github.io/buttons.js"></script>
234
  '''
235
 
236
  # e.g. To use a local alternative theme: carbon_theme = Carbon()
237
  carbon_theme = Carbon()
238
+ with gr.Blocks(css=css, head=head, theme='Tshackelton/IBMPlex-DenseReadable') as demo:
239
  import art
240
  text = art.__version__
241
 
 
258
  target="blank_">here</a>. To dive further into poisoning attacks with Hugging Face and ART, check out our
259
  <a href="https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/main/notebooks/hugging_face_poisoning.ipynb"
260
  target="_blank">notebook</a>. Also feel free to contribute and give our repo a ⭐.</i></p>''')
261
+
262
+ gr.Markdown('''
263
+
264
+ ''')
265
 
266
  gr.Markdown('''<hr/>''')
267
 
 
298
  a backdoor poisoning attack against your own model and assess its performance.</p>''')
299
 
300
  with gr.Row(elem_classes="custom-text"):
301
+ with gr.Column(scale=6):
302
  attack = gr.Textbox(visible=True, value="Backdoor", label="Attack", interactive=False)
303
  target_class = gr.Radio(label="Target class", info="The class you wish to force the model to predict.",
304
  choices=['church',
 
311
  'golf ball',
312
  'parachutte',], value='church')
313
  eval_btn_patch = gr.Button("Evaluate")
 
314
  with gr.Column(scale=10):
315
  clean_gallery = gr.Gallery(label="Clean", preview=False, show_download_button=True, height=600)
316
  clean_accuracy = gr.Number(label="Clean Accuracy", precision=2)
317
  with gr.Column(scale=1, min_width='0px', elem_classes='symbols'):
318
  gr.Markdown('''➕''')
319
+ with gr.Column(scale=3, elem_classes='symbols'):
320
+ trigger_image = gr.Image(label="Trigger", value="./baby-on-board.png", interactive=False)
321
  with gr.Column(scale=1, min_width='0px'):
322
  gr.Markdown('''🟰''', elem_classes='symbols')
323
  with gr.Column(scale=10):