Spaces:
Running
Running
Commit
·
0702aa5
1
Parent(s):
926ff01
added confidence .40 for detection
Browse files- QA_bot.py +2 -1
- tool_utils/yolo_world.py +2 -2
QA_bot.py
CHANGED
@@ -43,8 +43,9 @@ def tyre_synap_bot(filter_agent,image_file_path):
|
|
43 |
with st.chat_message("assistant"):
|
44 |
message_placeholder = st.empty()
|
45 |
full_response = ""
|
46 |
-
if ('
|
47 |
display_mask_image('final_mask.png')
|
|
|
48 |
|
49 |
for chunk in re.split(r'(\s+)', response):
|
50 |
full_response += chunk + " "
|
|
|
43 |
with st.chat_message("assistant"):
|
44 |
message_placeholder = st.empty()
|
45 |
full_response = ""
|
46 |
+
if os.path.isfile('final_mask.png'):
|
47 |
display_mask_image('final_mask.png')
|
48 |
+
# if ('Segmentation image' in ai_response['output']) or ('Predicted_image' in ai_response['output']):
|
49 |
|
50 |
for chunk in re.split(r'(\s+)', response):
|
51 |
full_response += chunk + " "
|
tool_utils/yolo_world.py
CHANGED
@@ -69,7 +69,7 @@ class YoloWorld:
|
|
69 |
scores = []
|
70 |
|
71 |
self.model.set_classes(object_prompts)
|
72 |
-
results = self.model.predict(image_path)
|
73 |
for result in results:
|
74 |
for i,box in enumerate(result.boxes):
|
75 |
x1, y1, x2, y2 = np.array(box.xyxy.cpu(), dtype=np.int32).squeeze()
|
@@ -91,7 +91,7 @@ class YoloWorld:
|
|
91 |
predicted_data = self.format_detections(bounding_boxes,labels)
|
92 |
# save image
|
93 |
cv2.imwrite('final_mask.png', cv2.cvtColor(detected_image,cv2.COLOR_BGR2RGB))
|
94 |
-
return "Predicted image : final_mask.png
|
95 |
|
96 |
if __name__ == "__main__":
|
97 |
yolo = YoloWorld()
|
|
|
69 |
scores = []
|
70 |
|
71 |
self.model.set_classes(object_prompts)
|
72 |
+
results = self.model.predict(image_path,conf=0.40)
|
73 |
for result in results:
|
74 |
for i,box in enumerate(result.boxes):
|
75 |
x1, y1, x2, y2 = np.array(box.xyxy.cpu(), dtype=np.int32).squeeze()
|
|
|
91 |
predicted_data = self.format_detections(bounding_boxes,labels)
|
92 |
# save image
|
93 |
cv2.imwrite('final_mask.png', cv2.cvtColor(detected_image,cv2.COLOR_BGR2RGB))
|
94 |
+
return "Predicted image : final_mask.png .\nDetails :\n{}".format(predicted_data)
|
95 |
|
96 |
if __name__ == "__main__":
|
97 |
yolo = YoloWorld()
|