Stopwolf commited on
Commit
82a1991
1 Parent(s): 5f394ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -21
app.py CHANGED
@@ -51,26 +51,35 @@ Demo for cascaded speech-to-speech translation (STST), mapping from source speec
51
  ![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
52
  """
53
 
54
- demo = gr.Blocks()
55
-
56
- mic_translate = gr.Interface(
57
- fn=speech_to_speech_translation,
58
- inputs=gr.Audio(source="microphone", type="filepath"),
59
- outputs=gr.Audio(label="Generated Speech", type="numpy"),
60
- title=title,
61
- description=description,
62
- )
63
-
64
- file_translate = gr.Interface(
65
- fn=speech_to_speech_translation,
66
- inputs=gr.Audio(source="upload", type="filepath"),
67
- outputs=gr.Audio(label="Generated Speech", type="numpy"),
68
- examples=[["./example.wav"]],
69
- title=title,
70
- description=description,
71
- )
72
-
73
- with demo:
74
- gr.TabbedInterface([mic_translate, file_translate], ["Microphone", "Audio File"])
 
 
 
 
 
 
 
 
 
75
 
76
  demo.launch()
 
51
  ![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
52
  """
53
 
54
+ # mic_translate = gr.Interface(
55
+ # fn=speech_to_speech_translation,
56
+ # inputs=gr.Audio(source="microphone", type="filepath"),
57
+ # outputs=gr.Audio(label="Generated Speech", type="numpy"),
58
+ # title=title,
59
+ # description=description,
60
+ # )
61
+
62
+ # file_translate = gr.Interface(
63
+ # fn=speech_to_speech_translation,
64
+ # inputs=gr.Audio(source="upload", type="filepath"),
65
+ # outputs=gr.Audio(label="Generated Speech", type="numpy"),
66
+ # examples=[["./example.wav"]],
67
+ # title=title,
68
+ # description=description,
69
+ # )
70
+
71
+ with gr.Blocks() as demo:
72
+
73
+ with gr.Row():
74
+ audio_in = gr.Microphone(label="Input audio", type="filepath")
75
+ audio_out = gr.Audio(label="Output audio", type="numpy", autoplay=True)
76
+
77
+ audio_in.stop_recording(
78
+ speech_to_speech_translation,
79
+ inputs=[audio_in],
80
+ outputs=[audio_out],
81
+ )
82
+
83
+ # gr.TabbedInterface([mic_translate, file_translate], ["Microphone", "Audio File"])
84
 
85
  demo.launch()