Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,24 +2,25 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from transformers import pipeline
|
4 |
|
5 |
-
#
|
6 |
-
|
7 |
-
|
8 |
-
pipe = pipeline("automatic-speech-recognition", model="infinitejoy/wav2vec2-large-xls-r-300m-bulgarian")
|
9 |
|
10 |
|
11 |
-
#
|
12 |
-
def
|
13 |
-
|
14 |
-
return
|
15 |
|
16 |
# Gradio μΈν°νμ΄μ€ μμ±
|
17 |
-
iface = gr.Interface(
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
|
23 |
# μΈν°νμ΄μ€ μ€ν
|
24 |
if __name__ == "__main__":
|
25 |
iface.launch()
|
|
|
|
2 |
import torch
|
3 |
from transformers import pipeline
|
4 |
|
5 |
+
# Initialize the ASR pipeline for Bulgarian
|
6 |
+
asr_pipeline = pipeline("automatic-speech-recognition", model="infinitejoy/wav2vec2-large-xls-r-300m-bulgarian")
|
|
|
|
|
7 |
|
8 |
|
9 |
+
# ASR λ³ν ν¨μ (speech-to-text conversion)
|
10 |
+
def asr_generate(audio):
|
11 |
+
transcription = asr_pipeline(audio)["text"]
|
12 |
+
return transcription
|
13 |
|
14 |
# Gradio μΈν°νμ΄μ€ μμ±
|
15 |
+
iface = gr.Interface(
|
16 |
+
fn=asr_generate,
|
17 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
18 |
+
outputs="text",
|
19 |
+
title="Bulgarian Speech Recognition",
|
20 |
+
description="Upload or record audio in Bulgarian to get the transcription."
|
21 |
+
)
|
22 |
|
23 |
# μΈν°νμ΄μ€ μ€ν
|
24 |
if __name__ == "__main__":
|
25 |
iface.launch()
|
26 |
+
|