pere commited on
Commit
9f35793
·
1 Parent(s): 5c6b453

update test

Browse files
Files changed (1) hide show
  1. app.py +34 -39
app.py CHANGED
@@ -83,49 +83,44 @@ def yt_transcribe(yt_url, return_timestamps=False):
83
 
84
  return html_embed_str, text
85
 
86
- demo = gr.Blocks()
87
 
88
- mf_transcribe = gr.Interface(
89
- fn=transcribe,
90
- inputs=[
91
- gr.components.Audio(sources=['upload', 'microphone'], type="filepath"),
92
- gr.components.Checkbox(label="Return timestamps"),
93
- ],
94
- outputs="text",
95
- title="NB-Whisper",
96
- description=(
97
- "Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the the fine-tuned"
98
- f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
99
- " of arbitrary length."
100
- ),
101
- allow_flagging="never",
102
- )
103
-
104
- yt_transcribe_interface = gr.Interface(
105
- fn=yt_transcribe,
106
- inputs=[
107
- gr.components.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
108
- gr.components.Checkbox(label="Return timestamps"),
109
- ],
110
- examples=[["https://www.youtube.com/watch?v=mukeSSa5GKo"]],
111
- outputs=["html", "text"],
112
- title="Whisper Demo: Transcribe YouTube",
113
- description=(
114
- "Transcribe long-form YouTube videos with the click of a button! Demo uses the the fine-tuned checkpoint:"
115
- f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of"
116
- " arbitrary length."
117
- ),
118
- allow_flagging="never",
119
- )
120
 
121
  with demo:
122
- gr.TabbedInterface(
123
- [mf_transcribe,
124
- # yt_transcribe_interface
 
 
125
  ],
126
- ["Transcribe Audio",
127
- # "Transcribe YouTube"
128
- ]
 
 
 
 
 
129
  )
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  demo.launch(share=share).queue()
 
83
 
84
  return html_embed_str, text
85
 
86
+ # Create the Gradio app without tabs
87
 
88
+ demo = gr.Blocks()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  with demo:
91
+ mf_transcribe = gr.Interface(
92
+ fn=transcribe,
93
+ inputs=[
94
+ gr.components.Audio(sources=['upload', 'microphone'], type="filepath"),
95
+ gr.components.Checkbox(label="Return timestamps"),
96
  ],
97
+ outputs="text",
98
+ title="NB-Whisper",
99
+ description=(
100
+ "Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the fine-tuned"
101
+ f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
102
+ " of arbitrary length."
103
+ ),
104
+ allow_flagging="never",
105
  )
106
 
107
+ # Optional: Uncomment to add the YouTube transcription interface if needed
108
+ # yt_transcribe_interface = gr.Interface(
109
+ # fn=yt_transcribe,
110
+ # inputs=[
111
+ # gr.components.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
112
+ # gr.components.Checkbox(label="Return timestamps"),
113
+ # ],
114
+ # examples=[["https://www.youtube.com/watch?v=mukeSSa5GKo"]],
115
+ # outputs=["html", "text"],
116
+ # title="Whisper Demo: Transcribe YouTube",
117
+ # description=(
118
+ # "Transcribe long-form YouTube videos with the click of a button! Demo uses the fine-tuned checkpoint:"
119
+ # f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of"
120
+ # " arbitrary length."
121
+ # ),
122
+ # allow_flagging="never",
123
+ # )
124
+
125
+ # Launch the demo without tabs
126
  demo.launch(share=share).queue()