Caroline Mai Chan
commited on
Commit
•
3743728
1
Parent(s):
0f3cd84
requirements and image demo
Browse files- app.py +14 -3
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
iface.launch()
|
|
|
1 |
+
import numpy as np
|
2 |
+
import torch
|
3 |
+
import torch.nn as nn
|
4 |
import gradio as gr
|
5 |
|
|
|
|
|
6 |
|
7 |
+
def sepia(input_img):
|
8 |
+
sepia_filter = np.array(
|
9 |
+
[[0.393, 0.769, 0.189], [0.349, 0.686, 0.168], [0.272, 0.534, 0.131]]
|
10 |
+
)
|
11 |
+
sepia_img = input_img.dot(sepia_filter.T)
|
12 |
+
sepia_img /= sepia_img.max()
|
13 |
+
return sepia_img
|
14 |
+
|
15 |
+
|
16 |
+
iface = gr.Interface(sepia, gr.inputs.Image(shape=(256, 256)), "image")
|
17 |
+
|
18 |
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
torch
|