Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import
|
3 |
|
4 |
# Load the ASR model and processor
|
5 |
-
asr_processor =
|
6 |
-
asr_model =
|
7 |
|
8 |
# Load the text processing model and tokenizer
|
9 |
-
proc_tokenizer =
|
10 |
-
proc_model =
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Load the TTS model and processor
|
13 |
-
tts_processor = VitsProcessor.from_pretrained("
|
14 |
-
tts_model = VitsForConditionalGeneration.from_pretrained("
|
15 |
|
16 |
def process_speech(speech):
|
17 |
# Convert the speech to text
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, Speech2TextProcessor, Speech2TextForConditionalGeneration, VitsProcessor, VitsForConditionalGeneration
|
3 |
|
4 |
# Load the ASR model and processor
|
5 |
+
asr_processor = Speech2TextProcessor.from_pretrained("/path/to/canary/processor")
|
6 |
+
asr_model = Speech2TextForConditionalGeneration.from_pretrained("/path/to/canary/model")
|
7 |
|
8 |
# Load the text processing model and tokenizer
|
9 |
+
proc_tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-128k-instruct")
|
10 |
+
proc_model = AutoModelForCausalLM.from_pretrained(
|
11 |
+
"microsoft/Phi-3-mini-128k-instruct",
|
12 |
+
device_map="cuda",
|
13 |
+
torch_dtype="auto",
|
14 |
+
trust_remote_code=True,
|
15 |
|
16 |
# Load the TTS model and processor
|
17 |
+
tts_processor = VitsProcessor.from_pretrained("/path/to/vits/processor")
|
18 |
+
tts_model = VitsForConditionalGeneration.from_pretrained("/path/to/vits/model")
|
19 |
|
20 |
def process_speech(speech):
|
21 |
# Convert the speech to text
|