Spaces:
Sleeping
Sleeping
j
commited on
Commit
·
a99646d
1
Parent(s):
5dbe57f
bypass audioldm waveform saving to predictably name output files
Browse files
README.md
CHANGED
@@ -3,6 +3,7 @@ title: AudioLDM Variations HARP plugin
|
|
3 |
emoji: 💻
|
4 |
colorFrom: blue
|
5 |
colorTo: yellow
|
|
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.15.0
|
8 |
app_file: app.py
|
|
|
3 |
emoji: 💻
|
4 |
colorFrom: blue
|
5 |
colorTo: yellow
|
6 |
+
python_version: 3.8
|
7 |
sdk: gradio
|
8 |
sdk_version: 4.15.0
|
9 |
app_file: app.py
|
app.py
CHANGED
@@ -2,22 +2,24 @@ from pyharp import ModelCard, build_endpoint, save_and_return_filepath
|
|
2 |
from audiotools import AudioSignal
|
3 |
from audioldm import build_model, save_wave, text_to_audio
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
audioldm = build_model(model_name="audioldm-m-full")
|
7 |
|
8 |
def process_fn(input_audio_path, seed, guidance_scale, num_inference_steps, num_candidates, audio_length_in_s):
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
|
23 |
card = ModelCard(
|
|
|
2 |
from audiotools import AudioSignal
|
3 |
from audioldm import build_model, save_wave, text_to_audio
|
4 |
import gradio as gr
|
5 |
+
import soundfile as sf
|
6 |
|
7 |
audioldm = build_model(model_name="audioldm-m-full")
|
8 |
|
9 |
def process_fn(input_audio_path, seed, guidance_scale, num_inference_steps, num_candidates, audio_length_in_s):
|
10 |
+
waveform = text_to_audio(
|
11 |
+
audioldm,
|
12 |
+
'placeholder',
|
13 |
+
input_audio_path,
|
14 |
+
seed = int(seed),
|
15 |
+
duration = audio_length_in_s,
|
16 |
+
guidance_scale = guidance_scale,
|
17 |
+
n_candidate_gen_per_text = int(num_candidates),
|
18 |
+
ddim_steps = int(num_inference_steps)
|
19 |
+
)
|
20 |
+
|
21 |
+
sf.write("./output.wav", waveform[0, 0], samplerate=16000)
|
22 |
+
#save_wave(waveform, "./", name="output.wav")
|
23 |
|
24 |
|
25 |
card = ModelCard(
|