Spaces:
Runtime error
Runtime error
Download gr/scripts/talents.py from AngoHF/Formulator: direct link, hf CLI and curl.
- Browser
- Download file 780 Bytes
-
https://huggingface.co/spaces/AngoHF/Formulator/resolve/main/gr/scripts/talents.py
- Command line
-
hf download hf://spaces/AngoHF/Formulator/gr/scripts/talents.py
-
curl -L -o talents.py https://huggingface.co/spaces/AngoHF/Formulator/resolve/main/gr/scripts/talents.py
780 Bytes
| from gr.components.talents import TalentsComponent | |
| from assets.constant import MAX_TALENTS | |
| class Talents: | |
| def __init__(self): | |
| self.talents = ["" for _ in range(MAX_TALENTS)] | |
| def __getitem__(self, item): | |
| return self.talents[item] | |
| def __setitem__(self, key, value): | |
| self.talents[key] = value | |
| def gains(self): | |
| return [talent for talent in self.talents if talent] | |
| def talents_script(talents_component: TalentsComponent): | |
| talents = Talents() | |
| def talent_changed(i): | |
| def inner(talent): | |
| talents[i] = talent | |
| return inner | |
| for n, talent_component in enumerate(talents_component.values()): | |
| talent_component.change(talent_changed(n), talent_component) | |
| return talents | |