Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,19 +5,22 @@ import numpy as np
|
|
| 5 |
|
| 6 |
fawkes_protection = FawkesProtection()
|
| 7 |
|
| 8 |
-
def process_image(
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 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.
|
| 19 |
title="Fawkes Image Protection",
|
| 20 |
-
description="Upload
|
| 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()
|