Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,10 +6,11 @@ def function(image):
|
|
| 6 |
model = YOLO('best_yolo_2.pt')
|
| 7 |
image = np.array(image)
|
| 8 |
results = model.predict(image)
|
| 9 |
-
img=Image.fromarray(
|
|
|
|
| 10 |
names_output=[]
|
| 11 |
for i in range(num_result):
|
| 12 |
-
name=
|
| 13 |
names_output.append(name)
|
| 14 |
return names_output,img
|
| 15 |
demo=gr.Interface(fn=function,inputs="image",outputs=["text","image"])
|
|
|
|
| 6 |
model = YOLO('best_yolo_2.pt')
|
| 7 |
image = np.array(image)
|
| 8 |
results = model.predict(image)
|
| 9 |
+
img=Image.fromarray(results[0].plot())
|
| 10 |
+
num_result=len(results[0].boxes.cls)
|
| 11 |
names_output=[]
|
| 12 |
for i in range(num_result):
|
| 13 |
+
name=results[0].names[int(results[0].boxes.cls[i])]
|
| 14 |
names_output.append(name)
|
| 15 |
return names_output,img
|
| 16 |
demo=gr.Interface(fn=function,inputs="image",outputs=["text","image"])
|