Spaces:
Build error
Build error
Download twNLP-app/src/context/reducer.py from lowannann/assignment_1: direct link, hf CLI and curl.
- Browser
- Download file 333 Bytes
-
https://huggingface.co/spaces/lowannann/assignment_1/resolve/main/twNLP-app/src/context/reducer.py
- Command line
-
hf download hf://spaces/lowannann/assignment_1/twNLP-app/src/context/reducer.py
-
curl -L -o reducer.py https://huggingface.co/spaces/lowannann/assignment_1/resolve/main/twNLP-app/src/context/reducer.py
333 Bytes
| from typing import Any, Union | |
| from .actions import WSGKind, Action | |
| def reducer(state, action: Action) -> Union[str, Any]: | |
| """The reducer function generates new states.""" | |
| initial_state = (state != None) if state else "" | |
| if action["kind"] == WSGKind.ADD_WSG: | |
| return action["payload"] | |
| return initial_state | |