Spaces:
Sleeping
Sleeping
j
commited on
Commit
·
cb86770
1
Parent(s):
93f8955
change output labeling and add timestamped output filenames
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from audiotools import AudioSignal
|
|
3 |
from audioldm import build_model, text_to_audio
|
4 |
import gradio as gr
|
5 |
import soundfile as sf
|
|
|
6 |
|
7 |
audioldm = build_model(model_name="audioldm-m-full")
|
8 |
|
@@ -18,9 +19,11 @@ def process_fn(input_audio_path, seed, guidance_scale, num_inference_steps, num_
|
|
18 |
ddim_steps = int(num_inference_steps)
|
19 |
)
|
20 |
|
21 |
-
|
|
|
|
|
22 |
#save_wave(waveform, "./", name="output.wav")
|
23 |
-
return
|
24 |
|
25 |
|
26 |
card = ModelCard(
|
@@ -66,10 +69,10 @@ with gr.Blocks() as webapp:
|
|
66 |
),
|
67 |
]
|
68 |
|
69 |
-
output = gr.Audio(label="Audio Output", type="filepath")
|
70 |
|
71 |
ctrls_data, ctrls_button, process_button, cancel_button = build_endpoint(inputs, output, process_fn, card)
|
72 |
|
73 |
# queue the webapp: https://www.gradio.app/guides/setting-up-a-demo-for-maximum-performance
|
74 |
-
|
75 |
webapp.launch(share=True)
|
|
|
3 |
from audioldm import build_model, text_to_audio
|
4 |
import gradio as gr
|
5 |
import soundfile as sf
|
6 |
+
from datetime import datetime
|
7 |
|
8 |
audioldm = build_model(model_name="audioldm-m-full")
|
9 |
|
|
|
19 |
ddim_steps = int(num_inference_steps)
|
20 |
)
|
21 |
|
22 |
+
timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
|
23 |
+
filename = f"./ldm_variations_{timestamp}.wav"
|
24 |
+
sf.write(filename, waveform[0, 0], samplerate=16000)
|
25 |
#save_wave(waveform, "./", name="output.wav")
|
26 |
+
return filename
|
27 |
|
28 |
|
29 |
card = ModelCard(
|
|
|
69 |
),
|
70 |
]
|
71 |
|
72 |
+
output = gr.Audio(label="Audio Output", type="filepath", format="wav", elem_id="audio")
|
73 |
|
74 |
ctrls_data, ctrls_button, process_button, cancel_button = build_endpoint(inputs, output, process_fn, card)
|
75 |
|
76 |
# queue the webapp: https://www.gradio.app/guides/setting-up-a-demo-for-maximum-performance
|
77 |
+
webapp.queue()
|
78 |
webapp.launch(share=True)
|