marciofk commited on
Commit
1e20b85
·
1 Parent(s): c4dedbe

Add application file

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Example 3
2
+ # Images (WebCam)
3
+
4
+ import numpy as np
5
+ import gradio as gr
6
+
7
+ def sepia(input_img):
8
+ print(input_img)
9
+
10
+ if input_img is None:
11
+ return None
12
+
13
+ sepia_filter = np.array([
14
+ [0.393, 0.769, 0.189],
15
+ [0.349, 0.686, 0.168],
16
+ [0.272, 0.534, 0.131]
17
+ ])
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(sources=['webcam'], streaming=False), "image")
24
+ demo.launch(share=False)