Upload model.py
Browse files
model.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal
|
| 2 |
+
|
| 3 |
+
TimeOfDay = Literal["morning", "afternoon", "evening", "night"]
|
| 4 |
+
|
| 5 |
+
def select_light_scene(time_of_day: str, activity: str) -> str:
|
| 6 |
+
"""Return a simple lighting scene_id hint from time of day and activity.
|
| 7 |
+
|
| 8 |
+
The scene_id is a high-level label, not necessarily the exact dataset row.
|
| 9 |
+
"""
|
| 10 |
+
t = time_of_day.lower()
|
| 11 |
+
a = activity.lower()
|
| 12 |
+
|
| 13 |
+
if "movie" in a:
|
| 14 |
+
return "LR_EVENING_MOVIE"
|
| 15 |
+
if "gaming" in a or "game" in a:
|
| 16 |
+
return "LR_GAME_TIME"
|
| 17 |
+
if "work" in a or "deep_work" in a or "office" in a:
|
| 18 |
+
return "OF_WORK_FOCUS"
|
| 19 |
+
if "cook" in a or "kitchen" in a:
|
| 20 |
+
return "KT_COOKING"
|
| 21 |
+
if "sleep" in a or "bed" in a or t == "night":
|
| 22 |
+
return "BR_NIGHT_SLEEP"
|
| 23 |
+
if "coffee" in a or ("relax" in a and t == "morning"):
|
| 24 |
+
return "LR_MORNING_SOFT"
|
| 25 |
+
|
| 26 |
+
# Fallback by time of day
|
| 27 |
+
if t == "morning":
|
| 28 |
+
return "LR_MORNING_SOFT"
|
| 29 |
+
if t == "afternoon":
|
| 30 |
+
return "OF_WORK_FOCUS"
|
| 31 |
+
if t == "evening":
|
| 32 |
+
return "LR_EVENING_MOVIE"
|
| 33 |
+
return "HW_NIGHT_SAFE"
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
if __name__ == "__main__":
|
| 37 |
+
tests = [
|
| 38 |
+
("evening", "watch_movie"),
|
| 39 |
+
("evening", "gaming"),
|
| 40 |
+
("afternoon", "deep_work"),
|
| 41 |
+
("morning", "coffee_relax"),
|
| 42 |
+
("night", "go_to_sleep"),
|
| 43 |
+
]
|
| 44 |
+
for t, act in tests:
|
| 45 |
+
print(t, act, "->", select_light_scene(t, act))
|