matesoft commited on
Commit
6fd995d
·
verified ·
1 Parent(s): a5cb7f3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+
4
+ def sepia(input_img):
5
+ sepia_filter = np.array([[.393, .769, .189],
6
+ [.349, .686, .168],
7
+ [.272, .534, .131]])
8
+ sepia_img = input_img @ sepia_filter.T
9
+ sepia_img = np.clip(sepia_img, 0, 255)
10
+ return sepia_img.astype(np.uint8)
11
+
12
+ iface = gr.Interface(
13
+ fn=sepia,
14
+ inputs=gr.Image(type="numpy"),
15
+ outputs=gr.Image(type="numpy"),
16
+ title="Sepia Filter App",
17
+ description="Upload an image and apply a vintage sepia filter! 📷"
18
+ )
19
+
20
+ iface.launch()