Spaces:
Running
Running
Gerold Meisinger
commited on
Commit
·
c34e459
1
Parent(s):
6b75921
init
Browse files- demo.py +18 -0
- dog2.png +0 -0
- packages.txt +1 -0
- requirements.txt +2 -0
demo.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import cv2
|
3 |
+
|
4 |
+
ed = cv2.ximgproc.createEdgeDrawing()
|
5 |
+
params = cv2.ximgproc.EdgeDrawing.Params()
|
6 |
+
params.PFmode = True
|
7 |
+
ed.setParams(params)
|
8 |
+
|
9 |
+
def edpf(image_rgb):
|
10 |
+
img_gray = cv2.cvtColor(image_rgb, cv2.COLOR_BGR2GRAY)
|
11 |
+
edges = ed.detectEdges(img_gray)
|
12 |
+
edge_map = ed.getEdgeImage(edges)
|
13 |
+
return edge_map
|
14 |
+
|
15 |
+
demo = gr.Interface(edpf, gr.Image(shape=(512, 512)), "image")
|
16 |
+
|
17 |
+
if __name__ == "__main__":
|
18 |
+
demo.launch()
|
dog2.png
ADDED
![]() |
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
python3-opencv
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio==3.44.4
|
2 |
+
opencv-contrib-python==4.8.0.76
|