Spaces:
Sleeping
Sleeping
Download src/formatting.py from tarekmasryo/rag-qa-command-cente: direct link, hf CLI and curl.
- Browser
- Download file 524 Bytes
-
https://huggingface.co/spaces/tarekmasryo/rag-qa-command-cente/resolve/main/src/formatting.py
- Command line
-
hf download hf://spaces/tarekmasryo/rag-qa-command-cente/src/formatting.py
-
curl -L -o formatting.py https://huggingface.co/spaces/tarekmasryo/rag-qa-command-cente/resolve/main/src/formatting.py
524 Bytes
| from __future__ import annotations | |
| import pandas as pd | |
| def fmt_pct(value: float) -> str: | |
| if pd.isna(value): | |
| return "n/a" | |
| return f"{float(value):.1%}" | |
| def fmt_money(value: float) -> str: | |
| if pd.isna(value): | |
| return "n/a" | |
| return f"${float(value):.4f}" | |
| def fmt_int(value: float | int) -> str: | |
| if pd.isna(value): | |
| return "n/a" | |
| return f"{int(value):,}" | |
| def fmt_latency_ms(value: float) -> str: | |
| if pd.isna(value): | |
| return "n/a" | |
| return f"{float(value):,.0f} ms" | |