Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
#
|
5 |
model_name = "Subhaka/whisper-small-Sinhala-Fine_Tune"
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# Define a transcription function
|
9 |
def transcribe_audio(audio_file):
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Specify the correct model name and adjust the loading configuration
|
5 |
model_name = "Subhaka/whisper-small-Sinhala-Fine_Tune"
|
6 |
+
|
7 |
+
# Define the pipeline with `use_safetensors=True`
|
8 |
+
def load_pipeline():
|
9 |
+
return pipeline(
|
10 |
+
"automatic-speech-recognition",
|
11 |
+
model=model_name,
|
12 |
+
use_safetensors=True, # Ensure compatibility with safetensors
|
13 |
+
)
|
14 |
+
|
15 |
+
# Load the model pipeline
|
16 |
+
transcriber = load_pipeline()
|
17 |
|
18 |
# Define a transcription function
|
19 |
def transcribe_audio(audio_file):
|