Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,28 @@
|
|
1 |
import gradio as gr
|
2 |
import AAMD
|
|
|
|
|
3 |
|
4 |
-
|
|
|
|
|
|
|
5 |
|
6 |
-
def
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
gr.Interface(
|
11 |
-
|
12 |
-
inputs=gr.inputs.Image(label="Upload
|
13 |
-
outputs=gr.outputs.
|
14 |
-
title=
|
15 |
).launch()
|
|
|
1 |
import gradio as gr
|
2 |
import AAMD
|
3 |
+
from pyAAMED import pyAAMED
|
4 |
+
import cv2
|
5 |
|
6 |
+
title = """
|
7 |
+
<h1>Arc Adjacency Matrix based Fast Ellipse Detection</h1>
|
8 |
+
<a href="https://github.com/Li-Zhaoxi/AAMED">Gitub</a>
|
9 |
+
"""
|
10 |
|
11 |
+
def detect_ellipses(img_path):
|
12 |
+
imgC = cv2.imread(img_path)
|
13 |
+
imgG = cv2.cvtColor(imgC, cv2.COLOR_BGR2GRAY)
|
14 |
+
|
15 |
+
aamed = pyAAMED(600, 600)
|
16 |
+
|
17 |
+
aamed.setParameters(3.1415926/3, 3.4, 0.77)
|
18 |
+
res = aamed.run_AAMED(imgG)
|
19 |
+
print(res)
|
20 |
+
|
21 |
+
return img
|
22 |
|
23 |
gr.Interface(
|
24 |
+
detect_ellipses,
|
25 |
+
inputs=gr.inputs.Image(label="Upload image with ellipses", type="filepath"),
|
26 |
+
outputs=gr.outputs.Image(label="Detected ellipses"),
|
27 |
+
title=title,
|
28 |
).launch()
|