Spaces:
Runtime error
Runtime error
AdalAbilbekov
commited on
Commit
•
c61a6f7
1
Parent(s):
3c785b2
123456
Browse files
app.py
CHANGED
@@ -62,6 +62,9 @@ vocoder.load_state_dict(torch.load(HIFIGAN_CHECKPT, map_location=lambda loc, sto
|
|
62 |
_ = vocoder.to(device).eval()
|
63 |
vocoder.remove_weight_norm()
|
64 |
|
|
|
|
|
|
|
65 |
def generate_audio(text, quantity, speaker, emotion_1, emotion_2):
|
66 |
x, x_lengths = convert_text(text)
|
67 |
emo_1, emo_2 = emotion_1, emotion_2
|
@@ -92,14 +95,11 @@ def generate_audio(text, quantity, speaker, emotion_1, emotion_2):
|
|
92 |
audio = audio * 32768.0
|
93 |
audio = audio.detach().cpu().numpy().astype('int16')
|
94 |
sr = 22050
|
95 |
-
return sr, audio
|
96 |
|
97 |
# def sentence_builder(quantity, emotion_1, emotion_2):
|
98 |
# return f"""The {quantity} {emotion_1}s from {" and ".join(emotion_2)}"""
|
99 |
|
100 |
-
emotions = sorted(["angry", "surprise", "fear", "happy", "neutral", "sad"])
|
101 |
-
spekears = ['Madi', 'Marzhan', 'Akzhol']
|
102 |
-
|
103 |
demo = gr.Interface(
|
104 |
generate_audio,
|
105 |
[
|
@@ -111,7 +111,7 @@ demo = gr.Interface(
|
|
111 |
gr.Dropdown(emotions, value=emotions[3], label="Emotion 2", info="Select second emotion."
|
112 |
),
|
113 |
],
|
114 |
-
"audio"
|
115 |
)
|
116 |
|
117 |
demo.launch()
|
|
|
62 |
_ = vocoder.to(device).eval()
|
63 |
vocoder.remove_weight_norm()
|
64 |
|
65 |
+
emotions = sorted(["angry", "surprise", "fear", "happy", "neutral", "sad"])
|
66 |
+
spekears = ['Madi', 'Marzhan', 'Akzhol']
|
67 |
+
|
68 |
def generate_audio(text, quantity, speaker, emotion_1, emotion_2):
|
69 |
x, x_lengths = convert_text(text)
|
70 |
emo_1, emo_2 = emotion_1, emotion_2
|
|
|
95 |
audio = audio * 32768.0
|
96 |
audio = audio.detach().cpu().numpy().astype('int16')
|
97 |
sr = 22050
|
98 |
+
return (sr, audio)
|
99 |
|
100 |
# def sentence_builder(quantity, emotion_1, emotion_2):
|
101 |
# return f"""The {quantity} {emotion_1}s from {" and ".join(emotion_2)}"""
|
102 |
|
|
|
|
|
|
|
103 |
demo = gr.Interface(
|
104 |
generate_audio,
|
105 |
[
|
|
|
111 |
gr.Dropdown(emotions, value=emotions[3], label="Emotion 2", info="Select second emotion."
|
112 |
),
|
113 |
],
|
114 |
+
"audio",
|
115 |
)
|
116 |
|
117 |
demo.launch()
|