otioss commited on
Commit
eaedf17
·
1 Parent(s): 922be41

two examples

Browse files
Files changed (1) hide show
  1. 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(""" # AccentCraft
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
 
226
- **The tool aims to assist learners in <ins>accent reduction</ins> and pronunciation improvement. It performs much better on <ins>longer speech</ins>.**
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
- *Initiate the recording process by selecting the **Record** button. You can also upload an audio file.*
252
- """)
253
  inp = gr.Audio(sources=["microphone", "upload"], format="wav", type="filepath",
254
- label="Your accent:",show_download_button="True")
255
  gr.Markdown("""
256
- *Press the **Run** button to listen to your native accent:*
257
- """)
258
  out = gr.Audio(label="Native accent:", autoplay="True", show_download_button="True")
259
- btn = gr.Button("Run")
260
- btn.click(transcribe, inputs=inp, outputs=out)
261
-
262
- gr.Markdown(
263
- """
264
- ## Remarks:
265
- - **The current inference may be somewhat slow due to the use of free vCPUs.**
266
- - **The author is optimistic about potentially upgrading to server GPUs in the future, which would significantly
267
- expedite the model's runtime to within a second.**
268
- - **Longer sentences yield a more naturally flowing result.
269
- Brief expressions like "Hi" or "How are you" may yield suboptimal outcomes.**
270
- - **The model might occasionally produce noise or generate random speech.
271
- Consider re-recording or re-running for enhanced clarity and accuracy.**
272
- - **By utilizing this application, you provide consent for your voice to
273
- be synthesized by pre-trained models.**
274
- - **This app has been made possible through the integration of excellent libraries such as Whisper and StyleTTS2.**
275
- - **If encountering an error, please try re-running or reloading the page.**
276
- - **This app primarily functions as an educational tool for English learners.
277
- The author does not endorse or support any malicious or misuse of this application.**
278
- - **The user acknowledges and agrees that the use of the software is at the user's sole risk.**
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__":