AdalAbilbekov
commited on
Commit
·
45fe7d7
1
Parent(s):
c61a6f7
CNN
Browse files- app.py +10 -2
- configs/train_grad.json +1 -1
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import argparse
|
|
|
3 |
import json
|
4 |
import datetime as dt
|
5 |
import numpy as np
|
@@ -67,7 +68,7 @@ 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
|
71 |
emo1 = torch.LongTensor([emo_1]).to(device)
|
72 |
emo2 = torch.LongTensor([emo_2]).to(device)
|
73 |
sid = torch.LongTensor([spekears.index(speaker)]).to(device)
|
@@ -97,6 +98,13 @@ def generate_audio(text, quantity, speaker, emotion_1, emotion_2):
|
|
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 |
|
@@ -113,5 +121,5 @@ demo = gr.Interface(
|
|
113 |
],
|
114 |
"audio",
|
115 |
)
|
116 |
-
|
117 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import argparse
|
3 |
+
import torchaudio
|
4 |
import json
|
5 |
import datetime as dt
|
6 |
import numpy as np
|
|
|
68 |
|
69 |
def generate_audio(text, quantity, speaker, emotion_1, emotion_2):
|
70 |
x, x_lengths = convert_text(text)
|
71 |
+
emo_1, emo_2 = emotions.index(emotion_1), emotions.index(emotion_2)
|
72 |
emo1 = torch.LongTensor([emo_1]).to(device)
|
73 |
emo2 = torch.LongTensor([emo_2]).to(device)
|
74 |
sid = torch.LongTensor([spekears.index(speaker)]).to(device)
|
|
|
98 |
sr = 22050
|
99 |
return (sr, audio)
|
100 |
|
101 |
+
|
102 |
+
|
103 |
+
def audio_check():
|
104 |
+
wav_path = '/Users/adalabilbekov/Desktop/ISSAI/experiments_yet/neutral_happy_time10_guid10_temp20.wav'
|
105 |
+
waveform, sr = torchaudio.load(wav_path)
|
106 |
+
return (sr, np.flipud(waveform))
|
107 |
+
|
108 |
# def sentence_builder(quantity, emotion_1, emotion_2):
|
109 |
# return f"""The {quantity} {emotion_1}s from {" and ".join(emotion_2)}"""
|
110 |
|
|
|
121 |
],
|
122 |
"audio",
|
123 |
)
|
124 |
+
print('launching the app')
|
125 |
demo.launch()
|
configs/train_grad.json
CHANGED
@@ -63,6 +63,6 @@
|
|
63 |
"h_decoder": 4,
|
64 |
"decoder_dropout":0.1,
|
65 |
|
66 |
-
"classifier_type": "CNN
|
67 |
}
|
68 |
}
|
|
|
63 |
"h_decoder": 4,
|
64 |
"decoder_dropout":0.1,
|
65 |
|
66 |
+
"classifier_type": "CNN"
|
67 |
}
|
68 |
}
|