Spaces:
Runtime error
Runtime error
Fabrice-TIERCELIN
commited on
Commit
•
fa7808c
1
Parent(s):
559b00c
No write
Browse files
app.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import json
|
3 |
import torch
|
4 |
-
import wavio
|
5 |
-
import spaces
|
6 |
|
7 |
from tqdm import tqdm
|
8 |
from huggingface_hub import snapshot_download
|
@@ -81,15 +79,10 @@ tango = Tango(device = "cpu")
|
|
81 |
tango.vae.to(device_type)
|
82 |
tango.stft.to(device_type)
|
83 |
tango.model.to(device_type)
|
84 |
-
|
85 |
-
@spaces.GPU(duration = 60)
|
86 |
def gradio_generate(prompt, steps, guidance):
|
87 |
output_wave = tango.generate(prompt, steps, guidance)
|
88 |
-
|
89 |
-
output_filename = "temp.wav"
|
90 |
-
wavio.write(output_filename, output_wave, rate = 16000, sampwidth = 2)
|
91 |
-
|
92 |
-
return output_filename
|
93 |
|
94 |
description_text = """
|
95 |
<p style="text-align: center;">
|
@@ -111,10 +104,11 @@ description_text = """
|
|
111 |
"""
|
112 |
# Gradio input and output components
|
113 |
input_text = gr.Textbox(label = "Prompt", value = "Snort of a horse", lines = 2, autofocus = True)
|
114 |
-
output_audio = gr.Audio(label = "Generated Audio", type = "filepath")
|
115 |
denoising_steps = gr.Slider(label = "Steps", minimum = 100, maximum = 200, value = 100, step = 1, interactive = True)
|
116 |
guidance_scale = gr.Slider(label = "Guidance Scale", minimum = 1, maximum = 10, value = 3, step = 0.1, interactive = True)
|
117 |
|
|
|
|
|
118 |
# Gradio interface
|
119 |
gr_interface = gr.Interface(
|
120 |
fn = gradio_generate,
|
|
|
1 |
import gradio as gr
|
2 |
import json
|
3 |
import torch
|
|
|
|
|
4 |
|
5 |
from tqdm import tqdm
|
6 |
from huggingface_hub import snapshot_download
|
|
|
79 |
tango.vae.to(device_type)
|
80 |
tango.stft.to(device_type)
|
81 |
tango.model.to(device_type)
|
82 |
+
|
|
|
83 |
def gradio_generate(prompt, steps, guidance):
|
84 |
output_wave = tango.generate(prompt, steps, guidance)
|
85 |
+
return gr.make_waveform((16000, output_wave))
|
|
|
|
|
|
|
|
|
86 |
|
87 |
description_text = """
|
88 |
<p style="text-align: center;">
|
|
|
104 |
"""
|
105 |
# Gradio input and output components
|
106 |
input_text = gr.Textbox(label = "Prompt", value = "Snort of a horse", lines = 2, autofocus = True)
|
|
|
107 |
denoising_steps = gr.Slider(label = "Steps", minimum = 100, maximum = 200, value = 100, step = 1, interactive = True)
|
108 |
guidance_scale = gr.Slider(label = "Guidance Scale", minimum = 1, maximum = 10, value = 3, step = 0.1, interactive = True)
|
109 |
|
110 |
+
output_audio = gr.Audio(label = "Generated Audio")
|
111 |
+
|
112 |
# Gradio interface
|
113 |
gr_interface = gr.Interface(
|
114 |
fn = gradio_generate,
|