tykiww commited on
Commit
0f20c1d
·
verified ·
1 Parent(s): 4049f7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import torch
2
  from TTS.api import TTS
3
  import gradio as gr
@@ -6,21 +7,16 @@ import spaces
6
  import yaml
7
 
8
 
 
9
  def get_config():
10
  # get config path
11
  config_path = os.environ["CONFIG_PATH"]
12
  # Parse the YAML file
13
  with open(config_path, 'r') as file:
14
  config = yaml.safe_load(file)
15
-
16
- print(config['inference'])
17
- print(config_path)
18
- return config
19
-
20
 
 
21
 
22
- # Agree to Terms of service
23
- # os.environ["COQUI_TOS_AGREED"] = "1"
24
 
25
  def init_TTS(config):
26
  # Get device
@@ -40,7 +36,7 @@ def generate_speech(text):
40
  return config['inference']['file_path']
41
 
42
 
43
-
44
  def main(config):
45
 
46
  # Create the Gradio interface
@@ -58,6 +54,8 @@ def main(config):
58
  demo.launch()
59
  return 0
60
 
 
 
61
  if __name__ == "__main__":
62
  # Get config
63
  config = get_config()
 
1
+ ###################################### imports ######################################
2
  import torch
3
  from TTS.api import TTS
4
  import gradio as gr
 
7
  import yaml
8
 
9
 
10
+ ###################################### utilities ######################################
11
  def get_config():
12
  # get config path
13
  config_path = os.environ["CONFIG_PATH"]
14
  # Parse the YAML file
15
  with open(config_path, 'r') as file:
16
  config = yaml.safe_load(file)
 
 
 
 
 
17
 
18
+ return config
19
 
 
 
20
 
21
  def init_TTS(config):
22
  # Get device
 
36
  return config['inference']['file_path']
37
 
38
 
39
+ ###################################### main ######################################
40
  def main(config):
41
 
42
  # Create the Gradio interface
 
54
  demo.launch()
55
  return 0
56
 
57
+
58
+ ###################################### Execute ######################################
59
  if __name__ == "__main__":
60
  # Get config
61
  config = get_config()