Campfireman commited on
Commit
ab4e539
1 Parent(s): b937c0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -1,18 +1,26 @@
1
  from transformers import pipeline
2
  import gradio as gr
 
3
 
4
- pipe = pipeline(model="sanchit-gandhi/whisper-small-hi") # change to "your-username/the-name-you-picked"
5
 
6
- def transcribe(audio):
 
7
  text = pipe(audio)["text"]
8
  return text
9
 
 
 
 
 
 
 
10
  iface = gr.Interface(
11
  fn=transcribe,
12
- inputs=gr.Audio(source="microphone", type="filepath"),
13
  outputs="text",
14
- title="Whisper Small Hindi",
15
- description="Realtime demo for Hindi speech recognition using a fine-tuned Whisper small model.",
16
  )
17
 
18
  iface.launch()
 
1
  from transformers import pipeline
2
  import gradio as gr
3
+ import moviepy.editor as mp
4
 
5
+ pipe = pipeline(model="Campfireman/whisper-medium-zh-CN") # change to "your-username/the-name-you-picked"
6
 
7
+ def transcribe(video):
8
+ audio = video_spliter(video)
9
  text = pipe(audio)["text"]
10
  return text
11
 
12
+ def video_spliter(video_in):
13
+ my_clip = mp.VideoFileClip(video_in)
14
+ my_audio = "audio_out.wav"
15
+ my_clip.audio.write_audiofile(my_audio)
16
+ return my_audio
17
+
18
  iface = gr.Interface(
19
  fn=transcribe,
20
+ inputs=gr.Video(...),
21
  outputs="text",
22
+ title="Whisper Medium Chinese",
23
+ description="Video Chinese Transcriptior",
24
  )
25
 
26
  iface.launch()