Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
|
|
23 |
|
24 |
return f"{prompt}.wav"
|
25 |
|
26 |
-
def infer_img2img(prompt, audio_path, progress=gr.Progress(track_tqdm=True)):
|
27 |
|
28 |
pretrained_model_name_or_path = "auffusion/auffusion-full-no-adapter"
|
29 |
dtype = torch.float16
|
@@ -39,7 +39,7 @@ def infer_img2img(prompt, audio_path, progress=gr.Progress(track_tqdm=True)):
|
|
39 |
pipe = pipe.to(device)
|
40 |
|
41 |
width_start, width = 0, 160
|
42 |
-
strength_list = [
|
43 |
prompt = "ambulance siren"
|
44 |
seed = 42
|
45 |
|
@@ -66,7 +66,7 @@ def infer_img2img(prompt, audio_path, progress=gr.Progress(track_tqdm=True)):
|
|
66 |
).images[0]
|
67 |
|
68 |
# add to image_list
|
69 |
-
output_spec = output_spec[:, :, :width]
|
70 |
output_spec_image = torch_to_pil(output_spec)
|
71 |
color_output_spec_image = image_add_color(output_spec_image)
|
72 |
image_list.append(color_output_spec_image)
|
@@ -158,6 +158,7 @@ with gr.Blocks(css=css) as demo:
|
|
158 |
with gr.Tab("Audio-to-Audio"):
|
159 |
prompt_img2img = gr.Textbox(label="Prompt")
|
160 |
audio_in_img2img = gr.Audio(label="Audio Reference", type="filepath")
|
|
|
161 |
submit_btn_img2img = gr.Button("Submit")
|
162 |
audio_out_img2img = gr.Audio(label="Audio Ressult")
|
163 |
|
@@ -172,7 +173,7 @@ with gr.Blocks(css=css) as demo:
|
|
172 |
|
173 |
submit_btn_img2img.click(
|
174 |
fn = infer_img2img,
|
175 |
-
inputs = [prompt_img2img, audio_in_img2img],
|
176 |
outputs = [audio_out_img2img]
|
177 |
)
|
178 |
|
|
|
23 |
|
24 |
return f"{prompt}.wav"
|
25 |
|
26 |
+
def infer_img2img(prompt, audio_path, desired_strength, progress=gr.Progress(track_tqdm=True)):
|
27 |
|
28 |
pretrained_model_name_or_path = "auffusion/auffusion-full-no-adapter"
|
29 |
dtype = torch.float16
|
|
|
39 |
pipe = pipe.to(device)
|
40 |
|
41 |
width_start, width = 0, 160
|
42 |
+
strength_list = [desired_strength]
|
43 |
prompt = "ambulance siren"
|
44 |
seed = 42
|
45 |
|
|
|
66 |
).images[0]
|
67 |
|
68 |
# add to image_list
|
69 |
+
# output_spec = output_spec[:, :, :width]
|
70 |
output_spec_image = torch_to_pil(output_spec)
|
71 |
color_output_spec_image = image_add_color(output_spec_image)
|
72 |
image_list.append(color_output_spec_image)
|
|
|
158 |
with gr.Tab("Audio-to-Audio"):
|
159 |
prompt_img2img = gr.Textbox(label="Prompt")
|
160 |
audio_in_img2img = gr.Audio(label="Audio Reference", type="filepath")
|
161 |
+
prompt_strength = gr.Slider(label="Prompt Strength", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
|
162 |
submit_btn_img2img = gr.Button("Submit")
|
163 |
audio_out_img2img = gr.Audio(label="Audio Ressult")
|
164 |
|
|
|
173 |
|
174 |
submit_btn_img2img.click(
|
175 |
fn = infer_img2img,
|
176 |
+
inputs = [prompt_img2img, audio_in_img2img, prompt_strength],
|
177 |
outputs = [audio_out_img2img]
|
178 |
)
|
179 |
|