Text-to-Audio
Diffusers
Safetensors
English
StableDiffusionPipeline
audio
audio-generation
diffusion
one-step-diffusion
variational-score-distillation
auffusion
Instructions to use dinhhung1508/SwiftAudio with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use dinhhung1508/SwiftAudio with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("dinhhung1508/SwiftAudio", 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
| import gradio as gr | |
| from inference import SAMPLE_RATE, generate_audio, load_model | |
| pipeline, vocoder, device, dtype = load_model() | |
| def predict(prompt, seed): | |
| audio = generate_audio( | |
| pipeline, vocoder, prompt, int(seed), device=device, dtype=dtype | |
| ) | |
| return SAMPLE_RATE, audio | |
| demo = gr.Interface( | |
| fn=predict, | |
| inputs=[ | |
| gr.Textbox(label="Prompt", placeholder="Rain and thunder"), | |
| gr.Number(label="Seed", value=42, precision=0), | |
| ], | |
| outputs=gr.Audio(label="Generated audio"), | |
| title="SwiftAudio", | |
| description="One-step text-to-audio generation with audio-free distillation.", | |
| examples=[ | |
| ["Rain and thunder", 42], | |
| ["Ocean waves with seabirds", 42], | |
| ["A train whistles", 42], | |
| ], | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |