SHREYSH commited on
Commit
ede5a9d
·
verified ·
1 Parent(s): f8d3ae4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -5,19 +5,22 @@ import numpy as np
5
 
6
  fawkes_protection = FawkesProtection()
7
 
8
- def process_image(image, protection_level):
9
- protected_image = fawkes_protection.predict(image, level=protection_level)
10
- return Image.fromarray(protected_image)
 
 
 
11
 
12
  iface = gr.Interface(
13
  fn=process_image,
14
  inputs=[
15
- gr.Image(type="pil"),
16
  gr.Radio(["low", "mid", "high"], label="Protection Level")
17
  ],
18
- outputs=gr.Image(type="pil"),
19
  title="Fawkes Image Protection",
20
- description="Upload an image to apply Fawkes protection."
21
  )
22
 
23
  iface.launch()
 
5
 
6
  fawkes_protection = FawkesProtection()
7
 
8
+ def process_image(images, protection_level):
9
+ protected_images = []
10
+ for image in images:
11
+ protected_image = fawkes_protection.predict(image, level=protection_level)
12
+ protected_images.append(protected_image)
13
+ return protected_images
14
 
15
  iface = gr.Interface(
16
  fn=process_image,
17
  inputs=[
18
+ gr.Image(type="pil", label="Images", elem_id="upload_images", multiupload=True),
19
  gr.Radio(["low", "mid", "high"], label="Protection Level")
20
  ],
21
+ outputs=gr.Gallery(type="pil", label="Protected Images"),
22
  title="Fawkes Image Protection",
23
+ description="Upload one or more images to apply Fawkes protection."
24
  )
25
 
26
  iface.launch()