Spaces:
Runtime error
Runtime error
removed gitignore
Browse files
app.py
CHANGED
|
@@ -1,18 +1,38 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
|
|
|
|
|
|
| 3 |
|
| 4 |
pipe = pipeline(model="Redve/BengaliModel")
|
| 5 |
|
| 6 |
def transcribe(audio):
|
| 7 |
text = pipe(audio)["text"]
|
|
|
|
| 8 |
return text
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
fn=transcribe,
|
| 12 |
-
inputs=gr.Audio(
|
| 13 |
outputs="text",
|
| 14 |
title="Whisper Small Bengali",
|
| 15 |
description="Realtime demo for Bengali speech recognition using a fine-tuned Whisper small model.",
|
| 16 |
)
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
+
import pytube as pt
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
pipe = pipeline(model="Redve/BengaliModel")
|
| 7 |
|
| 8 |
def transcribe(audio):
|
| 9 |
text = pipe(audio)["text"]
|
| 10 |
+
print(text)
|
| 11 |
return text
|
| 12 |
|
| 13 |
+
# def video(url):
|
| 14 |
+
# video = pt.YouTube(url)
|
| 15 |
+
# out_path = video.streams.filter(only_audio=True).first().download()
|
| 16 |
+
# name = os.path.splitext(out_path)[0]
|
| 17 |
+
# mp3_path = name + '.mp3'
|
| 18 |
+
# text = pipe(mp3_path)["text"]
|
| 19 |
+
# return text
|
| 20 |
+
|
| 21 |
+
audio= gr.Interface(
|
| 22 |
fn=transcribe,
|
| 23 |
+
inputs=gr.Audio(sources=["microphone"]),
|
| 24 |
outputs="text",
|
| 25 |
title="Whisper Small Bengali",
|
| 26 |
description="Realtime demo for Bengali speech recognition using a fine-tuned Whisper small model.",
|
| 27 |
)
|
| 28 |
|
| 29 |
+
# video = gr.Interface(
|
| 30 |
+
# fn=video,
|
| 31 |
+
# inputs="text",
|
| 32 |
+
# outputs="text",
|
| 33 |
+
# title="Whisper Small Bengali",
|
| 34 |
+
# description="Realtime demo for Bengali speech recognition using a fine-tuned Whisper small model.",
|
| 35 |
+
# )
|
| 36 |
+
|
| 37 |
+
audio.launch()
|
| 38 |
+
# video.launch()
|