Spaces:
Runtime error
Runtime error
two examples
Browse files- accent_gradio.py +41 -30
accent_gradio.py
CHANGED
@@ -219,11 +219,13 @@ def record_speaker(audio):
|
|
219 |
scipy.io.wavfile.write(original_voice_path, sr, scaled)
|
220 |
|
221 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
222 |
-
gr.Markdown(""" #
|
223 |
-
|
224 |
-
|
|
|
|
|
225 |
|
226 |
-
|
227 |
""")
|
228 |
# with gr.Accordion("First-Time Users (Click Here):", open=False):
|
229 |
# gr.Markdown("""
|
@@ -248,35 +250,44 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
248 |
|
249 |
with gr.Column():
|
250 |
gr.Markdown("""
|
251 |
-
|
252 |
-
|
253 |
inp = gr.Audio(sources=["microphone", "upload"], format="wav", type="filepath",
|
254 |
-
|
255 |
gr.Markdown("""
|
256 |
-
|
257 |
-
|
258 |
out = gr.Audio(label="Native accent:", autoplay="True", show_download_button="True")
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
|
281 |
|
282 |
if __name__ == "__main__":
|
|
|
219 |
scipy.io.wavfile.write(original_voice_path, sr, scaled)
|
220 |
|
221 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
222 |
+
gr.Markdown(""" # AccentCoach: Transform Any Accent into 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 |
+
|
225 |
+
**The tool aims to coach learners in <ins>accent reduction</ins> and pronunciation improvement. It performs much better on <ins>longer speech</ins>.**
|
226 |
+
**The code is based on style diffusion and adversarial training with LSLMs outlined in StyleTTS2 paper.**
|
227 |
|
228 |
+
**It is strongly advised to duplicate this space and run it on a powerful GPU. Inference time can be reduced to less than a second when utilizing an Nvidia 3090.**
|
229 |
""")
|
230 |
# with gr.Accordion("First-Time Users (Click Here):", open=False):
|
231 |
# gr.Markdown("""
|
|
|
250 |
|
251 |
with gr.Column():
|
252 |
gr.Markdown("""
|
253 |
+
*Initiate the recording process by selecting the **Record** button. Speak Clearly and ensure a noise-free environment.*
|
254 |
+
""")
|
255 |
inp = gr.Audio(sources=["microphone", "upload"], format="wav", type="filepath",
|
256 |
+
label="Original accent:",show_download_button="True")
|
257 |
gr.Markdown("""
|
258 |
+
*Press the **Run** button to listen to your native accent:*
|
259 |
+
""")
|
260 |
out = gr.Audio(label="Native accent:", autoplay="True", show_download_button="True")
|
261 |
+
btn = gr.Button("Run")
|
262 |
+
btn.click(transcribe, inputs=inp, outputs=out)
|
263 |
+
gr.Examples(
|
264 |
+
examples=[
|
265 |
+
["https://dl.sndup.net/9y9x/Albert-Einstein.wav",],
|
266 |
+
["https://dl.sndup.net/p6gz/Arnold-Schwarzenegger.wav" ,],
|
267 |
+
],
|
268 |
+
inputs=inp,
|
269 |
+
outputs=out,
|
270 |
+
fn=transcribe,
|
271 |
+
cache_examples=True,
|
272 |
+
)
|
273 |
+
|
274 |
+
gr.Markdown(
|
275 |
+
"""
|
276 |
+
## Remarks:
|
277 |
+
- **The optimal performance of the model is achieved when running on a GPU with a
|
278 |
+
minimum of 8GB of VRAM. However, due to budget constraints, the author is currently
|
279 |
+
limited to utilizing the free CPU on HF, resulting in slower inference speeds.**
|
280 |
+
- **Longer sentences yield a more naturally flowing result.
|
281 |
+
Brief expressions like "Hi" or "How are you" may yield suboptimal outcomes.**
|
282 |
+
- **The model might occasionally produce noise or generate random speech.
|
283 |
+
Consider re-recording or re-running for enhanced clarity and accuracy.**
|
284 |
+
- **By utilizing this application, you provide consent for your voice to
|
285 |
+
be synthesized by pre-trained models.**
|
286 |
+
- **If encountering an error, please try re-running or reloading the page.**
|
287 |
+
- **This app primarily functions as an educational tool for English learners.
|
288 |
+
The author does not endorse or support any malicious or misuse of this application.**
|
289 |
+
- **The user acknowledges and agrees that the use of the software is at the user's sole risk.**
|
290 |
+
""")
|
291 |
|
292 |
|
293 |
if __name__ == "__main__":
|