Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 2,174 Bytes
20bdfba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
from pydantic import BaseModel, Field
from typing import Literal, List, Union, Optional
class Behavior(BaseModel):
type: str
description: Optional[str] = None # Making the description field optional
# --- Specific Behavior classes ---
class AbnormalBreathing(Behavior):
type: Literal['abnormal breathing']
description: Optional[Literal["Problems breathing, breathing sounds"]] = None
class CrashFalling(Behavior):
type: Literal['crash, falling from the sky']
description: Optional[Literal["Suddenly falling from the sky"]] = None
class Diarrhea(Behavior):
type: Literal['diarrhea']
description: Optional[Literal["Observed diarrhea"]] = None
class Lameness(Behavior):
type: Literal['lameness']
description: Optional[Literal["Apparent limping or not able to walk properly"]] = None
class Neurological(Behavior):
type: Literal['neurological']
description: Optional[Literal["Circling, incoordination, tremors, convulsions, fast eye movements"]] = None
class OtherAbnormalBehavior(Behavior):
type: Literal['other abnormal behavior']
description: Optional[Literal["Other than weakness, other than neurologic"]] = None
class UnableToFly(Behavior):
type: Literal['unable to fly']
description: Optional[Literal["Animal alert and tries to fly but can not take off"]] = None
class Vomiting(Behavior):
type: Literal['vomiting']
description: Optional[Literal["Throwing up undigested food, regurgitating"]] = None
class Weakness(Behavior):
type: Literal['weakness']
description: Optional[Literal["Non responsive, does not fly away when approached, lethargy"]] = None
class NoChanges(Behavior):
type: Literal['no changes']
description: Optional[Literal["Animal is acting normally"]] = None
# Union of all possible behaviors
BehaviorType = Union[
AbnormalBreathing,
CrashFalling,
Diarrhea,
Lameness,
Neurological,
OtherAbnormalBehavior,
UnableToFly,
Vomiting,
Weakness,
NoChanges
]
# Main class that logs multiple behaviors
class Behaviors(BaseModel):
behaviors_radio: str # e.g., "Yes"
behaviors_type: Optional[List[BehaviorType]] = None
|