Views
No views yet
1messages = [
2 {
3 "role": "user",
4 "content": [
5 {"type": "image_url", "image_url": convert_to_base64(element_image)},
6 {
7 "type": "text",
8 "text": """Analyze the provided cropped image from a screenshot to determine whether it contains a single, valid, and visually complete UI element.
9
10 Criteria for validity:
11 - The image must contain exactly one UI element.
12 - The element must be entirely visible within the cropped area, with no significant cut-off parts.
13 - The image should not consist solely of background, empty space, or meaningless fragments.
14
15 Response format:
16 Conclude with your final determination in a dedicated section:
17
18 Conclusion
19 Yes (if the image contains a single, valid, and complete UI element)
20 No (if it does not meet the criteria)"""
21 }
22 ]
23 }
24]
251last_lines = response.strip().split('\n')[-2:]
2conclusion = " ".join(last_lines).lower()
3is_valid_box = "yes" in conclusion