SHREYSH commited on
Commit
09b5be9
·
verified ·
1 Parent(s): 196a1f0

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fawkes_wrapper_gradio_v_0_1 import FawkesProtection
3
+ from PIL import Image
4
+ 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()