Spaces:
Build error
Build error
adjoint-bass
commited on
Commit
•
7d13f08
1
Parent(s):
9fa7341
added app and requirements
Browse files- app.py +38 -0
- requirements.txt +4 -0
app.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
import hopsworks
|
4 |
+
from pytube import Youtube
|
5 |
+
|
6 |
+
amp = hopsworks.login()
|
7 |
+
data = amp.get_model_registry()
|
8 |
+
|
9 |
+
pipe = pipeline(model = 'CsanadT/model_name')
|
10 |
+
|
11 |
+
def live_performance(audio):
|
12 |
+
text = pipe(audio)['text']
|
13 |
+
return text
|
14 |
+
|
15 |
+
def url_performance(link):
|
16 |
+
selected_video = Youtube(str(link), only_audio = True)
|
17 |
+
|
18 |
+
|
19 |
+
with gr.Blocks() as demo:
|
20 |
+
with gr.Tab('Live audio'):
|
21 |
+
iface = gr.Interface(
|
22 |
+
fn=live_performance,
|
23 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
24 |
+
outputs="text",
|
25 |
+
title="Whisper Small Hungarian",
|
26 |
+
description="Real-time demo for Hungarian speech recognition using a fine-tuned Whisper small model."
|
27 |
+
)
|
28 |
+
|
29 |
+
with gr.Tab('Transcription from URL'):
|
30 |
+
iface = gr.Interface(
|
31 |
+
fn=url_performance,
|
32 |
+
inputs=gr.Textbox(label='Paste the UL here'),
|
33 |
+
outputs="text",
|
34 |
+
title="Whisper Small Hungarian",
|
35 |
+
description="Real-time demo for Hungarian speech recognition using a fine-tuned Whisper small model."
|
36 |
+
)
|
37 |
+
|
38 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pytube
|
2 |
+
scikit-learn
|
3 |
+
hopsworks
|
4 |
+
joblib
|