Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,9 @@ model_name = "hackergeek98/tinyyyy_whisper"
|
|
8 |
processor = WhisperProcessor.from_pretrained(model_name)
|
9 |
model = WhisperForConditionalGeneration.from_pretrained(model_name)
|
10 |
|
|
|
|
|
|
|
11 |
# Move model to GPU if available
|
12 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
13 |
model.to(device)
|
@@ -33,8 +36,8 @@ interface = gr.Interface(
|
|
33 |
fn=transcribe_audio, # Function to call
|
34 |
inputs=gr.Audio(type="filepath"), # Input: Upload audio file (any format)
|
35 |
outputs=gr.Textbox(label="Transcription"), # Output: Display transcription
|
36 |
-
title="Whisper ASR:
|
37 |
-
description="Upload an audio file (e.g., .wav, .mp3, .ogg), and the fine-tuned Whisper model will transcribe it.",
|
38 |
)
|
39 |
|
40 |
# Launch the app
|
|
|
8 |
processor = WhisperProcessor.from_pretrained(model_name)
|
9 |
model = WhisperForConditionalGeneration.from_pretrained(model_name)
|
10 |
|
11 |
+
# Force the model to transcribe in Persian
|
12 |
+
model.config.forced_decoder_ids = processor.get_decoder_prompt_ids(language="fa", task="transcribe")
|
13 |
+
|
14 |
# Move model to GPU if available
|
15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
model.to(device)
|
|
|
36 |
fn=transcribe_audio, # Function to call
|
37 |
inputs=gr.Audio(type="filepath"), # Input: Upload audio file (any format)
|
38 |
outputs=gr.Textbox(label="Transcription"), # Output: Display transcription
|
39 |
+
title="Whisper ASR: Persian Transcription",
|
40 |
+
description="Upload an audio file (e.g., .wav, .mp3, .ogg), and the fine-tuned Whisper model will transcribe it in Persian.",
|
41 |
)
|
42 |
|
43 |
# Launch the app
|