import gradio as gr | |
import numpy as np | |
def sepia(input_img): | |
sepia_filter = np.array([[.393, .769, .189], | |
[.349, .686, .168], | |
[.272, .534, .131]]) | |
sepia_img = input_img @ sepia_filter.T | |
sepia_img = np.clip(sepia_img, 0, 255) | |
return sepia_img.astype(np.uint8) | |
iface = gr.Interface( | |
fn=sepia, | |
inputs=gr.Image(type="numpy"), | |
outputs=gr.Image(type="numpy"), | |
title="Sepia Filter App", | |
description="Upload an image and apply a vintage sepia filter! 📷" | |
) | |
iface.launch() | |