Download srcs.py from 9x25dillon/LiMp-Pipeline-Integration-System: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/9x25dillon/LiMp-Pipeline-Integration-System/resolve/main/srcs.py
- Command line
-
hf download hf://9x25dillon/LiMp-Pipeline-Integration-System/srcs.py
-
curl -L -o srcs.py https://huggingface.co/9x25dillon/LiMp-Pipeline-Integration-System/resolve/main/srcs.py
1.07 kB
| class SelfReferentialBody: | |
| def __init__(self): | |
| self.places = { | |
| 'center': self.center_actions, | |
| 'memory': self.memory_actions, | |
| 'action': self.action_actions | |
| } | |
| self.current = 'center' | |
| def center_actions(self, command): | |
| actions = { | |
| 'remember': 'memory', | |
| 'act': 'action', | |
| 'reflect': 'center' | |
| } | |
| return actions.get(command, 'center') | |
| def memory_actions(self, command): | |
| # Can recall and reference other places | |
| if 'go to' in command: | |
| return command.split('go to ')[-1] | |
| return 'memory' | |
| def action_actions(self, command): | |
| # Actions that can reference the system itself | |
| if 'where am i' in command: | |
| return f"You're in {self.current}" | |
| return 'action' | |
| def command(self, text): | |
| next_place = self.places[self.current](text) | |
| if next_place in self.places: | |
| self.current = next_place | |
| return f"At {self.current}: {text}" |