Spaces:
Running on Zero
Running on Zero
Download continuousintelligence/_example.py from hugging-apps/ci-proto: direct link, hf CLI and curl.
- Browser
- Download file 684 Bytes
-
https://huggingface.co/spaces/hugging-apps/ci-proto/resolve/main/continuousintelligence/_example.py
- Command line
-
hf download hf://spaces/hugging-apps/ci-proto/continuousintelligence/_example.py
-
curl -L -o _example.py https://huggingface.co/spaces/hugging-apps/ci-proto/resolve/main/continuousintelligence/_example.py
684 Bytes
| """The bundled real-data forecasting example.""" | |
| import csv | |
| from importlib.resources import files | |
| import torch | |
| from torch import Tensor | |
| def load_example() -> Tensor: | |
| """Return the example's observed history as a CPU float32 tensor ``[1, 120]``. | |
| Forecast rows are excluded. Each call returns a new tensor. Data attribution | |
| and source information accompany the CSV in ``_data/NOTICE``. | |
| """ | |
| with files("continuousintelligence").joinpath("_data/bike_sharing.csv").open() as stream: | |
| values = [ | |
| float(row["rentals"]) for row in csv.DictReader(stream) if row["split"] == "history" | |
| ] | |
| return torch.tensor([values], dtype=torch.float32) | |