Pendrokar commited on
Commit
7d90a74
β€’
1 Parent(s): df59219

Load model only on gen

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -8,13 +8,9 @@ import threading
8
  import gradio as gr
9
 
10
  def run_xvaserver():
11
- # try:
12
  # start the process without waiting for a response
13
  print('Running xVAServer subprocess...\n')
14
  xvaserver = Popen(['python', f'{os.path.dirname(os.path.abspath(__file__))}/resources/app/server.py'], stdout=PIPE, stderr=PIPE, cwd=f'{os.path.dirname(os.path.abspath(__file__))}/resources/app/')
15
- # except:
16
- # print('Could not run xVASynth.')
17
- # sys.exit(0)
18
 
19
  # Wait for a moment to ensure the server starts up
20
  time.sleep(10)
@@ -24,7 +20,7 @@ def run_xvaserver():
24
  print("Web server failed to start.")
25
  sys.exit(0)
26
 
27
- # contact local xVASynth server; ~2 second timeout
28
  print('Attempting to connect to xVASynth...')
29
  try:
30
  response = requests.get('http://0.0.0.0:8008')
@@ -35,9 +31,6 @@ def run_xvaserver():
35
 
36
  print('xVAServer running on port 8008')
37
 
38
- # load default voice model
39
- load_model()
40
-
41
  # Wait for the process to exit
42
  xvaserver.wait()
43
 
@@ -104,9 +97,9 @@ def predict(input, pacing):
104
  response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
105
  except requests.exceptions.RequestException as err:
106
  print('Failed to synthesize!')
107
- print('server.log contents:')
108
- with open('resources/app/server.log', 'r') as f:
109
- print(f.read())
110
 
111
  return save_path
112
 
@@ -115,13 +108,13 @@ input_textbox = gr.Textbox(
115
  lines=1,
116
  autofocus=True
117
  )
118
- slider = gr.Slider(0.0, 2.0, value=1.0, step=0.1, label="Pacing")
119
 
120
  gradio_app = gr.Interface(
121
  predict,
122
  [
123
  input_textbox,
124
- slider
125
  ],
126
  outputs=gr.Audio(label="22kHz audio", type="filepath"),
127
  title="xVASynth (WIP)",
 
8
  import gradio as gr
9
 
10
  def run_xvaserver():
 
11
  # start the process without waiting for a response
12
  print('Running xVAServer subprocess...\n')
13
  xvaserver = Popen(['python', f'{os.path.dirname(os.path.abspath(__file__))}/resources/app/server.py'], stdout=PIPE, stderr=PIPE, cwd=f'{os.path.dirname(os.path.abspath(__file__))}/resources/app/')
 
 
 
14
 
15
  # Wait for a moment to ensure the server starts up
16
  time.sleep(10)
 
20
  print("Web server failed to start.")
21
  sys.exit(0)
22
 
23
+ # contact local xVASynth server
24
  print('Attempting to connect to xVASynth...')
25
  try:
26
  response = requests.get('http://0.0.0.0:8008')
 
31
 
32
  print('xVAServer running on port 8008')
33
 
 
 
 
34
  # Wait for the process to exit
35
  xvaserver.wait()
36
 
 
97
  response.raise_for_status() # If the response contains an HTTP error status code, raise an exception
98
  except requests.exceptions.RequestException as err:
99
  print('Failed to synthesize!')
100
+ print('server.log contents:')
101
+ with open('resources/app/server.log', 'r') as f:
102
+ print(f.read())
103
 
104
  return save_path
105
 
 
108
  lines=1,
109
  autofocus=True
110
  )
111
+ pacing_slider = gr.Slider(0.5, 2.0, value=1.0, step=0.1, label="Pacing")
112
 
113
  gradio_app = gr.Interface(
114
  predict,
115
  [
116
  input_textbox,
117
+ pacing_slider
118
  ],
119
  outputs=gr.Audio(label="22kHz audio", type="filepath"),
120
  title="xVASynth (WIP)",