Spaces:
Runtime error
Runtime error
change to direct audio
Browse files- accent_gradio.py +22 -21
- original_voice.wav +0 -3
accent_gradio.py
CHANGED
|
@@ -205,7 +205,8 @@ def transcribe(audio):
|
|
| 205 |
transcribed_text = "An error occured. Please try again."
|
| 206 |
|
| 207 |
print(transcribed_text)
|
| 208 |
-
ref_s = compute_style(original_voice_path)
|
|
|
|
| 209 |
wav = inference(transcribed_text, ref_s, alpha=0.1, beta=0.5, diffusion_steps=10, embedding_scale=1)
|
| 210 |
scaled = np.int16(wav / np.max(np.abs(wav)) * 32767)
|
| 211 |
return (sample_rate_value, scaled)
|
|
@@ -222,27 +223,27 @@ with gr.Blocks() as demo:
|
|
| 222 |
### Transform your non-native accent into a native North American accent.
|
| 223 |
**This is an educational app designed to transform the speech of a non-native English speaker into a native American accent.**
|
| 224 |
**The tool aims to assist learners in accent reduction and pronunciation improvement.**
|
| 225 |
-
**
|
| 226 |
""")
|
| 227 |
-
with gr.Accordion("First-Time Users (Click Here):", open=False):
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
|
| 247 |
|
| 248 |
with gr.Column():
|
|
|
|
| 205 |
transcribed_text = "An error occured. Please try again."
|
| 206 |
|
| 207 |
print(transcribed_text)
|
| 208 |
+
# ref_s = compute_style(original_voice_path) # run locally
|
| 209 |
+
ref_s = compute_style(audio) # run on HF
|
| 210 |
wav = inference(transcribed_text, ref_s, alpha=0.1, beta=0.5, diffusion_steps=10, embedding_scale=1)
|
| 211 |
scaled = np.int16(wav / np.max(np.abs(wav)) * 32767)
|
| 212 |
return (sample_rate_value, scaled)
|
|
|
|
| 223 |
### Transform your non-native accent into a native North American accent.
|
| 224 |
**This is an educational app designed to transform the speech of a non-native English speaker into a native American accent.**
|
| 225 |
**The tool aims to assist learners in accent reduction and pronunciation improvement.**
|
| 226 |
+
**This tool performs better on longer speech.**
|
| 227 |
""")
|
| 228 |
+
# with gr.Accordion("First-Time Users (Click Here):", open=False):
|
| 229 |
+
# gr.Markdown("""
|
| 230 |
+
# **Record the reference voice:** Kindly capture your voice as you read the provided
|
| 231 |
+
# text. Please ensure that you have granted microphone access in your browser settings.
|
| 232 |
+
|
| 233 |
+
# > I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration.
|
| 234 |
+
# I will face my fear. I will permit it to pass over me and through me. And when it has gone past I
|
| 235 |
+
# will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain.
|
| 236 |
+
|
| 237 |
+
# Ensure clarity in your pronunciation, as the quality of this recording
|
| 238 |
+
# significantly influences the future results. Once done please click "Save".
|
| 239 |
+
# If the quality of the native voice is not satisfactory, you can come back and
|
| 240 |
+
# re-record your voice here again.
|
| 241 |
+
|
| 242 |
+
# You can also upload your voice or someone else's voice.
|
| 243 |
+
# """)
|
| 244 |
+
# speaker_voice = gr.Audio(sources=["microphone", "upload"], format="wav", label="Record reference voice:",show_download_button="True")
|
| 245 |
+
# ref_btn = gr.Button("Save")
|
| 246 |
+
# ref_btn.click(record_speaker, inputs= speaker_voice, outputs=None)
|
| 247 |
|
| 248 |
|
| 249 |
with gr.Column():
|
original_voice.wav
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:ca4a4ef995535c9b58b46c4ba5a9512772a060a6e1ca5bdb1a23eba6fbf695e2
|
| 3 |
-
size 2304044
|
|
|
|
|
|
|
|
|
|
|
|