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(); |