Update cloning/clonevoice.py
Browse files- cloning/clonevoice.py +8 -1
cloning/clonevoice.py
CHANGED
@@ -6,10 +6,17 @@ from bark.hubert.customtokenizer import CustomTokenizer
|
|
6 |
|
7 |
import torchaudio
|
8 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
import os
|
10 |
import gradio
|
11 |
|
12 |
-
|
13 |
def clone_voice(audio_filepath, dest_filename, progress=gradio.Progress(track_tqdm=True)):
|
14 |
# if len(text) < 1:
|
15 |
# raise gradio.Error('No transcription text entered!')
|
|
|
6 |
|
7 |
import torchaudio
|
8 |
import torch
|
9 |
+
# Charge le modèle sur le CPU
|
10 |
+
model = torch.load('chemin_vers_ton_modele.pth', map_location=torch.device('cpu'))
|
11 |
+
model = model.eval()
|
12 |
+
|
13 |
+
# Si vous avez besoin de déplacer le modèle vers un dispositif spécifique après le chargement
|
14 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
15 |
+
model = model.to(device)
|
16 |
+
|
17 |
import os
|
18 |
import gradio
|
19 |
|
|
|
20 |
def clone_voice(audio_filepath, dest_filename, progress=gradio.Progress(track_tqdm=True)):
|
21 |
# if len(text) < 1:
|
22 |
# raise gradio.Error('No transcription text entered!')
|