Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,10 +25,7 @@ def detect(img):
|
|
| 25 |
scores = predictions[:, 4]
|
| 26 |
categories = predictions[:, 5]
|
| 27 |
new_image = np.squeeze(results.render())
|
| 28 |
-
|
| 29 |
-
width = int(img.shape[1] * scale_percent / 100)
|
| 30 |
-
height = int(img.shape[0] * scale_percent / 100)
|
| 31 |
-
dim = (width, height)
|
| 32 |
|
| 33 |
# resize image
|
| 34 |
new_image = cv2.resize(new_image, dim, interpolation = cv2.INTER_AREA)
|
|
@@ -38,7 +35,11 @@ def detect(img):
|
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
scores = predictions[:, 4]
|
| 26 |
categories = predictions[:, 5]
|
| 27 |
new_image = np.squeeze(results.render())
|
| 28 |
+
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# resize image
|
| 31 |
new_image = cv2.resize(new_image, dim, interpolation = cv2.INTER_AREA)
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
+
css = ".output-image, .input-image, .image-preview {height: 600px !important}"
|
| 39 |
|
| 40 |
+
iface = gr.Interface(fn=detect,
|
| 41 |
+
inputs=gr.inputs.Image(type="numpy",),
|
| 42 |
+
outputs=gr.outputs.Image(type="numpy",),
|
| 43 |
+
css=css,
|
| 44 |
+
enable_queue=True)
|
| 45 |
+
iface.launch(debug=True, cache_examples=True)
|