WCarlW commited on
Commit
c61959f
·
1 Parent(s): 05fa664

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +13 -9
  2. requirements.txt +1 -1
app.py CHANGED
@@ -1,21 +1,25 @@
1
  from transformers import pipeline
2
  import gradio as gr
3
- from huggingface_hub import notebook_login
4
 
5
- notebook_login()
6
 
7
- pipe = pipeline(model="WCarlW/whisper-small-hi") # change to "your-username/the-name-you-picked"
8
-
9
- def transcribe(audio):
 
10
  text = pipe(audio)["text"]
11
  return text
12
 
13
  iface = gr.Interface(
14
- fn=transcribe,
15
- inputs=gr.Audio(source="microphone", type="filepath"),
 
 
 
16
  outputs="text",
17
- title="Whisper Small Hindi",
18
- description="Realtime demo for Hindi speech recognition using a fine-tuned Whisper small model.",
19
  )
20
 
21
  iface.launch()
 
1
  from transformers import pipeline
2
  import gradio as gr
3
+ from pytube import YouTube
4
 
5
+ pipe = pipeline(model="kk90ujhun/whisper-small-zh") # change to "your-username/the-name-you-picked"
6
 
7
+ def transcribe(audio,url):
8
+ if url:
9
+ youtubeObject = YouTube(url).streams.first().download()
10
+ audio = youtubeObject
11
  text = pipe(audio)["text"]
12
  return text
13
 
14
  iface = gr.Interface(
15
+ fn=transcribe,
16
+ inputs=[
17
+ gr.Audio(source="microphone", type="filepath"),
18
+ gr.inputs.Textbox(label="give me an url",default ="https://www.youtube.com/watch?v=YzGsIavAo_E")
19
+ ],
20
  outputs="text",
21
+ title="Whisper Small Chinese",
22
+ description="Realtime demo for chinese speech recognition using a fine-tuned Whisper small model.",
23
  )
24
 
25
  iface.launch()
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
  gradio
2
  git+https://github.com/huggingface/transformers
3
- ipywidgets
 
1
  gradio
2
  git+https://github.com/huggingface/transformers
3
+ pytube