File size: 1,007 Bytes
10e72d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import warnings
from config import models_path, results_path, sample_path
from setup import setup_environment
from synthesis import load_models
from interface import create_interface

warnings.filterwarnings("ignore")

def main():
    os.makedirs(models_path, exist_ok=True)
    os.makedirs(results_path, exist_ok=True)
    
    if (not os.path.exists(os.path.join(models_path, 'encoder.pt')) or
        not os.path.exists(os.path.join(models_path, 'synthesizer.pt')) or
        not os.path.exists(os.path.join(models_path, 'vocoder_HiFiGAN.pkl')) or
        not os.path.exists(sample_path)):
        setup_success = setup_environment()
        if not setup_success:
            print("Setup failed. Exiting.")
            exit(1)
        print("Setup completed successfully.")
    
    load_success = load_models()
    if not load_success:
        print("Failed to load models. Exiting.")
        exit(1)
    
    demo = create_interface()
    demo.launch()

if __name__ == "__main__":
    main()