Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import soundfile as sf
|
4 |
+
from auffusion_pipeline import AuffusionPipeline
|
5 |
+
|
6 |
+
pipeline = AuffusionPipeline.from_pretrained("auffusion/auffusion")
|
7 |
+
|
8 |
+
def infer(prompt):
|
9 |
+
|
10 |
+
prompt = "Birds singing sweetly in a blooming garden"
|
11 |
+
output = pipeline(prompt=prompt)
|
12 |
+
audio = output.audios[0]
|
13 |
+
sf.write(f"{prompt}.wav", audio, samplerate=16000)
|
14 |
+
|
15 |
+
return f"{prompt}.wav"
|
16 |
+
|
17 |
+
with gr.Blocks() as demo:
|
18 |
+
with gr.Column():
|
19 |
+
gr.Markdown("# Auffusion")
|
20 |
+
prompt = gr.Textbox(label="Prompt")
|
21 |
+
submit_btn = gr.Button("Submit")
|
22 |
+
audio_out = gr.Audio(label="Audio Ressult")
|
23 |
+
|
24 |
+
submit_btn.click(
|
25 |
+
fn = infer,
|
26 |
+
inputs = [prompt],
|
27 |
+
outputs = [audio_out]
|
28 |
+
)
|
29 |
+
|
30 |
+
demo.queue().launch(show_api=False, show_error=True)
|