from pydantic import BaseModel from typing import List, Optional class Gesture(BaseModel): """Represents a detected gesture with metadata.""" gesture: str duration: int # Duration in frames confidence: float class GestureResponse(BaseModel): """Response model containing a list of detected gestures.""" gestures: List[Gesture] # Primary gesture mappings for the main gestures + additional ones GESTURE_MAPPING = { # Original 5 main gestures 27: "thumbs_up", # like 31: "palm", # open palm wave (5 fingers) 32: "peace", # peace sign (2 fingers) 29: "ok", # OK sign 20: "call", # call me (little finger) # Finger counting (1-5) 30: "one", # 1 finger 39: "two_up", # 2 fingers (peace sign) 37: "three", # 3 fingers 26: "four", # 4 fingers # Note: 5 fingers is same as palm (31) # Surprise gesture 23: "middle_finger", # middle finger (surprise!) # Additional useful gestures 25: "fist", # closed fist 19: "point", # pointing with index finger 35: "stop", # stop gesture } # Additional gesture mappings for completeness FULL_GESTURE_MAPPING = { 0: "hand_down", 1: "hand_right", 2: "hand_left", 3: "thumb_index", 4: "thumb_left", 5: "thumb_right", 6: "thumb_down", 7: "half_up", 8: "half_left", 9: "half_right", 10: "half_down", 11: "part_hand_heart", 12: "part_hand_heart2", 13: "fist_inverted", 14: "two_left", 15: "two_right", 16: "two_down", 17: "grabbing", 18: "grip", 19: "point", 20: "call", 21: "three3", 22: "little_finger", 23: "middle_finger", 24: "dislike", 25: "fist", 26: "four", 27: "like", 28: "mute", 29: "ok", 30: "one", 31: "palm", 32: "peace", 33: "peace_inverted", 34: "rock", 35: "stop", 36: "stop_inverted", 37: "three", 38: "three2", 39: "two_up", 40: "two_up_inverted", 41: "three_gun", 42: "one_left", 43: "one_right", 44: "one_down" }