File size: 824 Bytes
09b5be9
b6ddc8b
09b5be9
 
 
 
 
ede5a9d
 
 
 
 
 
09b5be9
 
 
 
ede5a9d
09b5be9
 
ede5a9d
09b5be9
ede5a9d
09b5be9
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
from fawkes_wrapper_gradio_v_1_0 import FawkesProtection
from PIL import Image
import numpy as np

fawkes_protection = FawkesProtection()

def process_image(images, protection_level):
    protected_images = []
    for image in images:
        protected_image = fawkes_protection.predict(image, level=protection_level)
        protected_images.append(protected_image)
    return protected_images

iface = gr.Interface(
    fn=process_image,
    inputs=[
        gr.Image(type="pil", label="Images", elem_id="upload_images", multiupload=True),
        gr.Radio(["low", "mid", "high"], label="Protection Level")
    ],
    outputs=gr.Gallery(type="pil", label="Protected Images"),
    title="Fawkes Image Protection",
    description="Upload one or more images to apply Fawkes protection."
)

iface.launch()