Timing-up commited on
Commit
5c41c67
·
verified ·
1 Parent(s): 06dd2cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -6
app.py CHANGED
@@ -1,7 +1,21 @@
1
- import gradio as gr
 
 
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
-
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ os.system("""python -m pip install -i https://mirrors.aliyun.com/pypi/simple/ --upgrade pip setuptools
3
+ pip install -i https://mirrors.aliyun.com/pypi/simple/ gradio
4
+ pip install -i https://mirrors.aliyun.com/pypi/simple/ cv2
5
+ """)
6
+
7
 
8
+
9
+ import numpy as np
10
+ import gradio as gr
11
+ import cv2
12
+
13
+ def gray(input_img):
14
+ grayImage = cv2.cvtColor(input_img, cv2.COLOR_BGR2GRAY)
15
+ return grayImage
16
+
17
+ input = gr.Image(height=300, width=300, label="Upload Image") #label 代表输入框的标题
18
+ output = gr.Image()
19
+
20
+ demo = gr.Interface(fn=gray, inputs=input, outputs = output)
21
+ demo.launch(share=True)