Update app.py
Browse files
app.py
CHANGED
@@ -30,10 +30,14 @@ def image_preprocess(image):
|
|
30 |
model = YOLO('best (1).pt')
|
31 |
|
32 |
def response(image):
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
35 |
# im_rgb = Image.fromarray(im_rgb)
|
36 |
-
return
|
37 |
|
38 |
iface = gr.Interface(fn=response, inputs="image", outputs="image")
|
39 |
iface.launch()
|
|
|
30 |
model = YOLO('best (1).pt')
|
31 |
|
32 |
def response(image):
|
33 |
+
results = model(image)
|
34 |
+
for i, r in enumerate(results):
|
35 |
+
# Plot results image
|
36 |
+
im_bgr = r.plot() # BGR-order numpy array
|
37 |
+
im_rgb = im_bgr[..., ::-1] # Convert BGR to RGB
|
38 |
+
|
39 |
# im_rgb = Image.fromarray(im_rgb)
|
40 |
+
return im_rgb
|
41 |
|
42 |
iface = gr.Interface(fn=response, inputs="image", outputs="image")
|
43 |
iface.launch()
|