Commit
·
baaac86
1
Parent(s):
122040d
v2.0.1-Image input filter
Browse files- app.py +16 -2
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
def sepia(input_img):
|
5 |
+
sepia_filter = np.array([
|
6 |
+
[0.393, 0.769, 0.189],
|
7 |
+
[0.349, 0.686, 0.168],
|
8 |
+
[0.272, 0.534, 0.131]
|
9 |
+
])
|
10 |
+
sepia_img = input_img.dot(sepia_filter.T)
|
11 |
+
sepia_img /= sepia_img.max()
|
12 |
+
return sepia_img
|
13 |
|
14 |
def greet(name):
|
15 |
return "Hello " + name + "!!"
|
16 |
|
17 |
+
demo = gr.Interface(fn=sepia, inputs="image", outputs="image")
|
18 |
+
demo.launch()
|
19 |
+
|
20 |
+
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
21 |
+
# iface.launch()
|
requirements.txt
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
gradio
|
|
|
|
1 |
+
gradio
|
2 |
+
numpy
|