wtest / app.py
Weaita's picture
Update app.py
edb0e97
raw
history blame contribute delete
529 Bytes
import gradio as gr
import numpy as np
from PIL import Image
def add_watermark(image):
image = Image.fromarray(np.uint8(image))
watermark = Image.open("watermark.png")
image = image.convert("RGBA")
watermark = watermark.convert("RGBA")
watermark = watermark.resize((image.width, image.height))
image.paste(watermark,(0,0),watermark)
return image
gr.Interface(fn=add_watermark,
inputs="image",
outputs="image",
title="Add watermark"
).launch();