SaladSlayer00
commited on
Commit
•
0a6a4fd
1
Parent(s):
9ed6f07
the app
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
pipe = pipeline(model="SaladSlayer00/another_local")
|
5 |
+
|
6 |
+
|
7 |
+
def transcribe(rec=None, file=None):
|
8 |
+
if rec is not None:
|
9 |
+
audio = rec
|
10 |
+
elif file is not None:
|
11 |
+
audio = file
|
12 |
+
else:
|
13 |
+
return "Provide a recording or a file."
|
14 |
+
|
15 |
+
text = pipe(audio)["text"]
|
16 |
+
return text
|
17 |
+
|
18 |
+
|
19 |
+
iface = gr.Interface(
|
20 |
+
fn=transcribe,
|
21 |
+
inputs=[
|
22 |
+
gr.Audio(type="filepath")
|
23 |
+
],
|
24 |
+
outputs="text",
|
25 |
+
title="Whisper Small Italian",
|
26 |
+
description="Realtime demo for Italian speech recognition using a fine-tuned Whisper model.",
|
27 |
+
)
|
28 |
+
|
29 |
+
|
30 |
+
iface.launch()
|