Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,9 @@ config = BarkConfig()
|
|
22 |
model = Bark.init_from_config(config)
|
23 |
model.load_checkpoint(config, checkpoint_dir="checkpoints/bark", eval=True)
|
24 |
|
|
|
|
|
|
|
25 |
def infer(prompt, input_wav_file):
|
26 |
|
27 |
print("SAVING THE AUDIO FILE TO WHERE IT BELONGS")
|
@@ -44,6 +47,7 @@ def infer(prompt, input_wav_file):
|
|
44 |
# Move the WAV file to the new directory
|
45 |
shutil.move(source_path, os.path.join(destination_path, f"{file_name}.wav"))
|
46 |
|
|
|
47 |
text = prompt
|
48 |
|
49 |
print("SYNTHETIZING...")
|
@@ -62,6 +66,8 @@ def infer(prompt, input_wav_file):
|
|
62 |
|
63 |
print(output_dict)
|
64 |
|
|
|
|
|
65 |
sample_rate = 24000 # Replace with the actual sample rate
|
66 |
print("WRITING WAVE FILE")
|
67 |
wavfile.write(
|
@@ -69,6 +75,12 @@ def infer(prompt, input_wav_file):
|
|
69 |
sample_rate,
|
70 |
output_dict['wav']
|
71 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
# List all the files and subdirectories in the given directory
|
74 |
contents = os.listdir(f"bark_voices/{file_name}")
|
|
|
22 |
model = Bark.init_from_config(config)
|
23 |
model.load_checkpoint(config, checkpoint_dir="checkpoints/bark", eval=True)
|
24 |
|
25 |
+
from TTS.api import TTS
|
26 |
+
tts = TTS("tts_models/multilingual/multi-dataset/bark", gpu=True)
|
27 |
+
|
28 |
def infer(prompt, input_wav_file):
|
29 |
|
30 |
print("SAVING THE AUDIO FILE TO WHERE IT BELONGS")
|
|
|
47 |
# Move the WAV file to the new directory
|
48 |
shutil.move(source_path, os.path.join(destination_path, f"{file_name}.wav"))
|
49 |
|
50 |
+
"""
|
51 |
text = prompt
|
52 |
|
53 |
print("SYNTHETIZING...")
|
|
|
66 |
|
67 |
print(output_dict)
|
68 |
|
69 |
+
|
70 |
+
|
71 |
sample_rate = 24000 # Replace with the actual sample rate
|
72 |
print("WRITING WAVE FILE")
|
73 |
wavfile.write(
|
|
|
75 |
sample_rate,
|
76 |
output_dict['wav']
|
77 |
)
|
78 |
+
"""
|
79 |
+
|
80 |
+
tts.tts_to_file(text=prompt,
|
81 |
+
file_path="output.wav",
|
82 |
+
voice_dir="bark_voices/",
|
83 |
+
speaker=f"{file_name}")
|
84 |
|
85 |
# List all the files and subdirectories in the given directory
|
86 |
contents = os.listdir(f"bark_voices/{file_name}")
|