File size: 564 Bytes
6fd995d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()