Spaces:
Build error
Build error
Download twNLP-app/src/views/services/request.py from lowannann/assignment_1: direct link, hf CLI and curl.
- Browser
- Download file 694 Bytes
-
https://huggingface.co/spaces/lowannann/assignment_1/resolve/main/twNLP-app/src/views/services/request.py
- Command line
-
hf download hf://spaces/lowannann/assignment_1/twNLP-app/src/views/services/request.py
-
curl -L -o request.py https://huggingface.co/spaces/lowannann/assignment_1/resolve/main/twNLP-app/src/views/services/request.py
694 Bytes
| import streamlit as st | |
| from typing import Callable | |
| from controllers.cwn import handle_create_cwn_tags | |
| from controllers.ckip import handle_create_ner, handle_create_pos, handle_create_wsg | |
| TEN_MINUTES = 60 * 10 | |
| def request(method: str, *args, **kwargs) -> Callable: | |
| """The request function fetches the data based on the `method`. | |
| Args: | |
| method (str): the request method | |
| Returns: | |
| a controller function | |
| """ | |
| methods = { | |
| "ner": handle_create_ner, | |
| "pos": handle_create_pos, | |
| "wsg": handle_create_wsg, | |
| "cwn": handle_create_cwn_tags, | |
| } | |
| return methods[method](*args, **kwargs) | |