Added n_candidates
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ processor = AutoProcessor.from_pretrained("sanchit-gandhi/clap-htsat-unfused-m-f
|
|
19 |
|
20 |
generator = torch.Generator(device)
|
21 |
|
22 |
-
def texttoaudio(prompt, neg_prompt, seed, inf_steps, guidance_scale):
|
23 |
if prompt is None:
|
24 |
raise gr.Error("Please provide a text input.")
|
25 |
|
@@ -30,6 +30,7 @@ def texttoaudio(prompt, neg_prompt, seed, inf_steps, guidance_scale):
|
|
30 |
guidance_scale=guidance_scale,
|
31 |
audio_length_in_s=5.0,
|
32 |
generator=generator.manual_seed(int(seed)),
|
|
|
33 |
)["audios"]
|
34 |
|
35 |
# save the audio sample as a .wav file
|
@@ -51,6 +52,6 @@ def score_waveforms(text, waveforms):
|
|
51 |
waveform = waveforms[most_probable]
|
52 |
return waveform
|
53 |
|
54 |
-
iface = gr.Interface(fn=texttoaudio, title="
|
55 |
|
56 |
iface.launch()
|
|
|
19 |
|
20 |
generator = torch.Generator(device)
|
21 |
|
22 |
+
def texttoaudio(prompt, neg_prompt, seed, inf_steps, guidance_scale, n_candidates):
|
23 |
if prompt is None:
|
24 |
raise gr.Error("Please provide a text input.")
|
25 |
|
|
|
30 |
guidance_scale=guidance_scale,
|
31 |
audio_length_in_s=5.0,
|
32 |
generator=generator.manual_seed(int(seed)),
|
33 |
+
num_waveforms_per_prompt=n_candidates if n_candidates else 1,
|
34 |
)["audios"]
|
35 |
|
36 |
# save the audio sample as a .wav file
|
|
|
52 |
waveform = waveforms[most_probable]
|
53 |
return waveform
|
54 |
|
55 |
+
iface = gr.Interface(fn=texttoaudio, title="AudioLDM Testing Playground", inputs=["text", "text", "number", "number", "number", "number"], outputs="audio")
|
56 |
|
57 |
iface.launch()
|