Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import cv2
|
| 3 |
import numpy as np
|
|
|
|
| 4 |
|
| 5 |
def preprocess(img):
|
| 6 |
# Convert to grayscale
|
|
@@ -121,8 +122,10 @@ def infer(image_in):
|
|
| 121 |
cv2.imwrite("Arrows_on_same_blank.png", img_result)
|
| 122 |
|
| 123 |
print(f"arrows coordinates: {arrows_coordinates}")
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
return "Image_result.png", "Arrows_on_same_blank.png"
|
| 126 |
|
| 127 |
gr.Interface(
|
| 128 |
fn=infer,
|
|
@@ -133,6 +136,7 @@ gr.Interface(
|
|
| 133 |
outputs=[
|
| 134 |
gr.Image(),
|
| 135 |
gr.Image(),
|
|
|
|
| 136 |
|
| 137 |
]
|
| 138 |
).launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import cv2
|
| 3 |
import numpy as np
|
| 4 |
+
import json
|
| 5 |
|
| 6 |
def preprocess(img):
|
| 7 |
# Convert to grayscale
|
|
|
|
| 122 |
cv2.imwrite("Arrows_on_same_blank.png", img_result)
|
| 123 |
|
| 124 |
print(f"arrows coordinates: {arrows_coordinates}")
|
| 125 |
+
json_output = json.dumps(arrows_coordinates)
|
| 126 |
+
print(json_output)
|
| 127 |
|
| 128 |
+
return "Image_result.png", "Arrows_on_same_blank.png", json_output
|
| 129 |
|
| 130 |
gr.Interface(
|
| 131 |
fn=infer,
|
|
|
|
| 136 |
outputs=[
|
| 137 |
gr.Image(),
|
| 138 |
gr.Image(),
|
| 139 |
+
gr.JSON()
|
| 140 |
|
| 141 |
]
|
| 142 |
).launch()
|