Spaces:
Runtime error
Runtime error
try to save result in a local file?
Browse files
app.py
CHANGED
|
@@ -42,7 +42,10 @@ def predict(img: np.ndarray) -> str:
|
|
| 42 |
print(f'result is: {type(result)}')
|
| 43 |
print(result.shape)
|
| 44 |
print(result)
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
# For each detection, the description is in the [x_min, y_min, x_max, y_max, conf] format:
|
|
@@ -104,7 +107,7 @@ enable_queue=True
|
|
| 104 |
gr.Interface(
|
| 105 |
fn=predict,
|
| 106 |
inputs=gr.inputs.Image(),
|
| 107 |
-
outputs=gr.outputs.Image(),
|
| 108 |
title=title,
|
| 109 |
description=description,
|
| 110 |
#examples=examples,
|
|
|
|
| 42 |
print(f'result is: {type(result)}')
|
| 43 |
print(result.shape)
|
| 44 |
print(result)
|
| 45 |
+
|
| 46 |
+
result_fp = 'temp_result.jpg'
|
| 47 |
+
cv2.imwrite(result_fp, result)
|
| 48 |
+
return result_fp
|
| 49 |
|
| 50 |
|
| 51 |
# For each detection, the description is in the [x_min, y_min, x_max, y_max, conf] format:
|
|
|
|
| 107 |
gr.Interface(
|
| 108 |
fn=predict,
|
| 109 |
inputs=gr.inputs.Image(),
|
| 110 |
+
outputs=gr.outputs.Image(type='filepath'),
|
| 111 |
title=title,
|
| 112 |
description=description,
|
| 113 |
#examples=examples,
|