Spaces:
Running
Running
Abdullh911
commited on
Commit
·
d47664e
1
Parent(s):
c55c17b
wowww
Browse files- app.py +26 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from tangoflux import TangoFluxInference
|
4 |
+
|
5 |
+
# Initialize model (auto-downloads on first run)
|
6 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
7 |
+
model = TangoFluxInference(name="declare-lab/TangoFlux", device=device)
|
8 |
+
|
9 |
+
def generate_audio(prompt, steps, duration):
|
10 |
+
audio = model.generate(prompt=prompt, steps=steps, duration=duration)
|
11 |
+
return 44100, audio
|
12 |
+
|
13 |
+
# Gradio interface
|
14 |
+
demo = gr.Interface(
|
15 |
+
fn=generate_audio,
|
16 |
+
inputs=[
|
17 |
+
gr.Textbox(lines=2, label="Prompt"),
|
18 |
+
gr.Slider(25, 100, value=50, step=1, label="Steps"),
|
19 |
+
gr.Slider(1, 30, value=10, step=1, label="Duration (s)")
|
20 |
+
],
|
21 |
+
outputs=gr.Audio(type="numpy", label="Generated Audio"),
|
22 |
+
title="TangoFlux: Text-to-Audio Generation",
|
23 |
+
description="Generate sound effects (e.g., lightning, thunder) using TangoFlux."
|
24 |
+
)
|
25 |
+
|
26 |
+
demo.queue().launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
tangoflux>=0.1.0
|
2 |
+
torch
|
3 |
+
gradio
|