Spaces:
Sleeping
Sleeping
Download rl.py from gaurang671/SmartEmailAI2: direct link, hf CLI and curl.
- Browser
- Download file 327 Bytes
-
https://huggingface.co/spaces/gaurang671/SmartEmailAI2/resolve/main/rl.py
- Command line
-
hf download hf://spaces/gaurang671/SmartEmailAI2/rl.py
-
curl -L -o rl.py https://huggingface.co/spaces/gaurang671/SmartEmailAI2/resolve/main/rl.py
327 Bytes
| Q = {} | |
| actions = ["important", "spam", "normal"] | |
| def get_action(state): | |
| if state not in Q: | |
| Q[state] = {a: 0 for a in actions} | |
| return max(Q[state], key=Q[state].get) | |
| def update_q(state, action, reward): | |
| if state not in Q: | |
| Q[state] = {a: 0 for a in actions} | |
| Q[state][action] += reward |