sanchit-gandhi HF staff commited on
Commit
c737803
1 Parent(s): c6f1d54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -47,7 +47,9 @@ Demo for cascaded speech-to-speech translation (STST), mapping from source speec
47
  ![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
48
  """
49
 
50
- demo = gr.Interface(
 
 
51
  fn=speech_to_speech_translation,
52
  inputs=gr.Audio(source="microphone", type="filepath"),
53
  outputs=gr.Audio(label="Generated Speech", type="numpy"),
@@ -55,4 +57,17 @@ demo = gr.Interface(
55
  title=title,
56
  description=description,
57
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  demo.launch()
 
47
  ![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
48
  """
49
 
50
+ demo = gr.Blocks()
51
+
52
+ mic_translate = gr.Interface(
53
  fn=speech_to_speech_translation,
54
  inputs=gr.Audio(source="microphone", type="filepath"),
55
  outputs=gr.Audio(label="Generated Speech", type="numpy"),
 
57
  title=title,
58
  description=description,
59
  )
60
+
61
+ file_translate = gr.Interface(
62
+ fn=speech_to_speech_translation,
63
+ inputs=gr.Audio(source="upload", type="filepath"),
64
+ outputs=gr.Audio(label="Generated Speech", type="numpy"),
65
+ examples=[["./example.wav"]],
66
+ title=title,
67
+ description=description,
68
+ )
69
+
70
+ with demo:
71
+ gr.TabbedInterface([mic_transcribe, file_transcribe], ["Microphone", "Audio File"])
72
+
73
  demo.launch()