File size: 995 Bytes
41a2fd1
169e8d6
c0d5772
 
169e8d6
41a2fd1
 
 
 
c0d5772
41a2fd1
 
c0d5772
 
 
 
 
 
 
 
 
41a2fd1
5809163
41a2fd1
 
 
 
169e8d6
c0d5772
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from transformers import pipeline
import gradio as gr
import pytube as pt
import os

pipe = pipeline(model="Redve/BengaliModel")

def transcribe(audio):
    text = pipe(audio)["text"]
    print(text)
    return text

# def video(url):
#     video = pt.YouTube(url)
#     out_path = video.streams.filter(only_audio=True).first().download()
#     name = os.path.splitext(out_path)[0]
#     mp3_path = name + '.mp3'
#     text = pipe(mp3_path)["text"]
#     return text

audio= gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(sources=["microphone"], type="filepath"),
    outputs="text",
    title="Whisper Small Bengali",
    description="Realtime demo for Bengali speech recognition using a fine-tuned Whisper small model.",
)

# video = gr.Interface(
#     fn=video,
#     inputs="text",
#     outputs="text",
#     title="Whisper Small Bengali",
#     description="Realtime demo for Bengali speech recognition using a fine-tuned Whisper small model.",
# )

audio.launch()
# video.launch()