Spaces:
Runtime error
Runtime error
Update app.py (#7)
Browse files- Update app.py (61e03a0a367964f1c4ab5239b103af189bbbe6af)
app.py
CHANGED
|
@@ -6,6 +6,7 @@ from transformers import pipeline
|
|
| 6 |
from huggingface_hub import model_info
|
| 7 |
|
| 8 |
MODEL_NAME = "openai/whisper-small" #this always needs to stay in line 8 :D sorry for the hackiness
|
|
|
|
| 9 |
|
| 10 |
device = 0 if torch.cuda.is_available() else "cpu"
|
| 11 |
|
|
@@ -16,6 +17,8 @@ pipe = pipeline(
|
|
| 16 |
device=device,
|
| 17 |
)
|
| 18 |
|
|
|
|
|
|
|
| 19 |
def transcribe(microphone, file_upload):
|
| 20 |
warn_output = ""
|
| 21 |
if (microphone is not None) and (file_upload is not None):
|
|
|
|
| 6 |
from huggingface_hub import model_info
|
| 7 |
|
| 8 |
MODEL_NAME = "openai/whisper-small" #this always needs to stay in line 8 :D sorry for the hackiness
|
| 9 |
+
lang = "en"
|
| 10 |
|
| 11 |
device = 0 if torch.cuda.is_available() else "cpu"
|
| 12 |
|
|
|
|
| 17 |
device=device,
|
| 18 |
)
|
| 19 |
|
| 20 |
+
pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
|
| 21 |
+
|
| 22 |
def transcribe(microphone, file_upload):
|
| 23 |
warn_output = ""
|
| 24 |
if (microphone is not None) and (file_upload is not None):
|