Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,14 +17,7 @@ def predict_image(img):
|
|
| 17 |
im_array = r.plot()
|
| 18 |
im = Image.fromarray(im_array[..., ::-1])
|
| 19 |
|
| 20 |
-
|
| 21 |
-
class_names = [model.names[int(cls)] for cls in r.boxes.cls]
|
| 22 |
-
confidences = r.boxes.conf.tolist()
|
| 23 |
-
|
| 24 |
-
# Create a formatted string of results
|
| 25 |
-
result_text = "\n".join([f"{name}: {conf:.2f}" for name, conf in zip(class_names, confidences)])
|
| 26 |
-
|
| 27 |
-
return im, result_text
|
| 28 |
|
| 29 |
iface = gr.Interface(
|
| 30 |
fn=predict_image,
|
|
|
|
| 17 |
im_array = r.plot()
|
| 18 |
im = Image.fromarray(im_array[..., ::-1])
|
| 19 |
|
| 20 |
+
return im
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
iface = gr.Interface(
|
| 23 |
fn=predict_image,
|