Instructions to use aa-studio/aa_studio_data with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use aa-studio/aa_studio_data with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("aa-studio/aa_studio_data", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download ComfyUI/web/scripts/ui/toggleSwitch.js from aa-studio/aa_studio_data: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/aa-studio/aa_studio_data/resolve/07e165bcf451b7c06e1d39ffecf3d1fa5937cfb7/ComfyUI/web/scripts/ui/toggleSwitch.js
- Command line
-
hf download hf://aa-studio/aa_studio_data@07e165bcf451b7c06e1d39ffecf3d1fa5937cfb7/ComfyUI/web/scripts/ui/toggleSwitch.js
-
curl -L -o toggleSwitch.js https://huggingface.co/aa-studio/aa_studio_data/resolve/07e165bcf451b7c06e1d39ffecf3d1fa5937cfb7/ComfyUI/web/scripts/ui/toggleSwitch.js
1.47 kB
| import { $el } from "../ui.js"; | |
| /** | |
| * @typedef { { text: string, value?: string, tooltip?: string } } ToggleSwitchItem | |
| */ | |
| /** | |
| * Creates a toggle switch element | |
| * @param { string } name | |
| * @param { Array<string | ToggleSwitchItem } items | |
| * @param { Object } [opts] | |
| * @param { (e: { item: ToggleSwitchItem, prev?: ToggleSwitchItem }) => void } [opts.onChange] | |
| */ | |
| export function toggleSwitch(name, items, { onChange } = {}) { | |
| let selectedIndex; | |
| let elements; | |
| function updateSelected(index) { | |
| if (selectedIndex != null) { | |
| elements[selectedIndex].classList.remove("comfy-toggle-selected"); | |
| } | |
| onChange?.({ item: items[index], prev: selectedIndex == null ? undefined : items[selectedIndex] }); | |
| selectedIndex = index; | |
| elements[selectedIndex].classList.add("comfy-toggle-selected"); | |
| } | |
| elements = items.map((item, i) => { | |
| if (typeof item === "string") item = { text: item }; | |
| if (!item.value) item.value = item.text; | |
| const toggle = $el( | |
| "label", | |
| { | |
| textContent: item.text, | |
| title: item.tooltip ?? "", | |
| }, | |
| $el("input", { | |
| name, | |
| type: "radio", | |
| value: item.value ?? item.text, | |
| checked: item.selected, | |
| onchange: () => { | |
| updateSelected(i); | |
| }, | |
| }) | |
| ); | |
| if (item.selected) { | |
| updateSelected(i); | |
| } | |
| return toggle; | |
| }); | |
| const container = $el("div.comfy-toggle-switch", elements); | |
| if (selectedIndex == null) { | |
| elements[0].children[0].checked = true; | |
| updateSelected(0); | |
| } | |
| return container; | |
| } | |