init
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'''
|
2 |
+
Author : Alafun
|
3 |
+
GitHub Page : https://github.com/Alafun/
|
4 |
+
Date : 2022-06-21 16:43:21
|
5 |
+
LastEditors : Alafun
|
6 |
+
LastEditTime : 2022-06-21 16:45:11
|
7 |
+
Description :
|
8 |
+
FilePath : \\app.py
|
9 |
+
Copyright (c) 2022 by Alafun, All Rights Reserved.
|
10 |
+
'''
|
11 |
+
import numpy as np
|
12 |
+
|
13 |
+
import gradio as gr
|
14 |
+
|
15 |
+
def sepia(input_img):
|
16 |
+
sepia_filter = np.array(
|
17 |
+
[[0.393, 0.769, 0.189], [0.349, 0.686, 0.168], [0.272, 0.534, 0.131]]
|
18 |
+
)
|
19 |
+
sepia_img = input_img.dot(sepia_filter.T)
|
20 |
+
sepia_img /= sepia_img.max()
|
21 |
+
return sepia_img
|
22 |
+
|
23 |
+
demo = gr.Interface(sepia, gr.Image(shape=(200, 200)), "image")
|
24 |
+
|
25 |
+
demo.launch()
|