Spaces:
Build error
Build error
Commit ·
8622f98
1
Parent(s): 86264b2
add docstring
Browse files- heinsight.py +11 -1
heinsight.py
CHANGED
|
@@ -277,8 +277,18 @@ class HeinSight:
|
|
| 277 |
ax3.set_xticks([self.x_time[0], self.x_time[-1]], realtime_tick_label)
|
| 278 |
|
| 279 |
|
| 280 |
-
def image_demo(self, pil_image, cap_ratio=0):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
self.clear_cache()
|
| 283 |
frame = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) # PIL → OpenCV
|
| 284 |
phase_data = {}
|
|
|
|
| 277 |
ax3.set_xticks([self.x_time[0], self.x_time[-1]], realtime_tick_label)
|
| 278 |
|
| 279 |
|
| 280 |
+
def image_demo(self, pil_image:Image.Image, cap_ratio=0):
|
| 281 |
+
"""
|
| 282 |
+
analyze a vial image using heinsight. detect vial and dectet chemical content inside the vial.
|
| 283 |
+
|
| 284 |
+
Args:
|
| 285 |
+
pil_image (Image.Image): The input text to search through
|
| 286 |
+
cap_ratio (float): The ratio of the vial cap to the vial height
|
| 287 |
|
| 288 |
+
Returns:
|
| 289 |
+
output_image: output image with bounding boxes and detected chemical content
|
| 290 |
+
output_dict: output dict with turbidity, volume and color values
|
| 291 |
+
"""
|
| 292 |
self.clear_cache()
|
| 293 |
frame = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) # PIL → OpenCV
|
| 294 |
phase_data = {}
|