Download controllers/models/data_models.py from seba3y/SpeakLab: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/seba3y/SpeakLab/resolve/main/controllers/models/data_models.py
- Command line
-
hf download hf://spaces/seba3y/SpeakLab/controllers/models/data_models.py
-
curl -L -o data_models.py https://huggingface.co/spaces/seba3y/SpeakLab/resolve/main/controllers/models/data_models.py
1.07 kB
| """ | |
| Pydantic models for the static JSON data files. | |
| """ | |
| from pydantic import BaseModel, field_validator | |
| class TongueTwister(BaseModel): | |
| text: str | |
| focus: str | |
| class TTLevels(BaseModel): | |
| easy: list[TongueTwister] | |
| medium: list[TongueTwister] | |
| hard: list[TongueTwister] | |
| class ImpCategory(BaseModel): | |
| category: str | |
| questions: list[str] | |
| def questions_not_empty(cls, v: list[str]) -> list[str]: | |
| if not v: | |
| raise ValueError("questions list must not be empty") | |
| return v | |
| class IvCategory(BaseModel): | |
| category: str | |
| questions: list[str] | |
| def questions_not_empty(cls, v: list[str]) -> list[str]: | |
| if not v: | |
| raise ValueError("questions list must not be empty") | |
| return v | |
| class AppData(BaseModel): | |
| """Container holding all loaded JSON data (validated at startup).""" | |
| jam: list[str] | |
| tt: TTLevels | |
| impromptu: list[ImpCategory] | |
| interview: list[IvCategory] | |