File size: 638 Bytes
09b5be9
b6ddc8b
09b5be9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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(image, protection_level):
    protected_image = fawkes_protection.predict(image, level=protection_level)
    return Image.fromarray(protected_image)

iface = gr.Interface(
    fn=process_image,
    inputs=[
        gr.Image(type="pil"),
        gr.Radio(["low", "mid", "high"], label="Protection Level")
    ],
    outputs=gr.Image(type="pil"),
    title="Fawkes Image Protection",
    description="Upload an image to apply Fawkes protection."
)

iface.launch()