Marco-Cheung
commited on
Commit
•
71c7a94
1
Parent(s):
de411e0
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
import torch
|
4 |
-
from transformers import AutoProcessor, pipeline, BarkModel
|
5 |
|
6 |
ASR_MODEL_NAME = "bofenghuang/whisper-large-v2-cv11-german"
|
7 |
TTS_MODEL_NAME = "suno/bark-small"
|
@@ -18,6 +18,11 @@ asr_pipe = pipeline("automatic-speech-recognition", model=ASR_MODEL_NAME, chunk_
|
|
18 |
# set the forced ids
|
19 |
asr_pipe.model.config.forced_decoder_ids = asr_pipe.tokenizer.get_decoder_prompt_ids(language='de', task="translate")
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
# load text-to-speech checkpoint
|
22 |
processor = AutoProcessor.from_pretrained("suno/bark-small")
|
23 |
model = BarkModel.from_pretrained("suno/bark-small").to(device)
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
import torch
|
4 |
+
from transformers import AutoProcessor, pipeline, BarkModel, GenerationConfig
|
5 |
|
6 |
ASR_MODEL_NAME = "bofenghuang/whisper-large-v2-cv11-german"
|
7 |
TTS_MODEL_NAME = "suno/bark-small"
|
|
|
18 |
# set the forced ids
|
19 |
asr_pipe.model.config.forced_decoder_ids = asr_pipe.tokenizer.get_decoder_prompt_ids(language='de', task="translate")
|
20 |
|
21 |
+
MULTILINGUAL = True # set True for multilingual models, False for English-only
|
22 |
+
|
23 |
+
if MULTILINGUAL:
|
24 |
+
generation_config = GenerationConfig.from_pretrained("openai/whisper-large-v2")
|
25 |
+
|
26 |
# load text-to-speech checkpoint
|
27 |
processor = AutoProcessor.from_pretrained("suno/bark-small")
|
28 |
model = BarkModel.from_pretrained("suno/bark-small").to(device)
|