Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,21 @@
|
|
| 1 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|