gradio/js/statustracker/static/utils.ts
pngwn fbdad78af4
Lazy load interactive or static variants of a component individually, rather than loading both variants regardless. This change will improve performance for many applications. (#5215)
* lazy load compoennts more granularly

* add changeset

* format

* add changeset

* fix casing

* fix casing

* fix casing

* revert changelog formatting

* add changeset

* revert changelog formatting

* add changeset

* make interactive updates work

* revert changelog stuff

* fix order

* fix static dataframe

* revert demo change

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2023-08-15 19:21:41 +01:00

11 lines
273 B
TypeScript

export function pretty_si(num: number): string {
let units = ["", "k", "M", "G", "T", "P", "E", "Z"];
let i = 0;
while (num > 1000 && i < units.length - 1) {
num /= 1000;
i++;
}
let unit = units[i];
return (Number.isInteger(num) ? num : num.toFixed(1)) + unit;
}