SHREYSH's picture
Update app.py
ede5a9d verified
raw
history blame
824 Bytes
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()