skytnt commited on
Commit
ed10f4a
β€’
1 Parent(s): 496b2d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import json
2
- from signal import SIGTERM
 
3
 
4
  import librosa
5
  import numpy as np
@@ -48,7 +49,7 @@ def create_vc_fn(model, hps, speaker_ids):
48
  return "You need to upload an audio", None
49
  sampling_rate, audio = input_audio
50
  duration = audio.shape[0] / sampling_rate
51
- if limitation and duration > 20:
52
  return "Error: Audio is too long", None
53
  original_speaker_id = speaker_ids[original_speaker]
54
  target_speaker_id = speaker_ids[target_speaker]
@@ -79,7 +80,7 @@ def kill_proc():
79
  for proc in process_iter():
80
  for conns in proc.connections(kind='inet'):
81
  if conns.laddr.port == 7860:
82
- proc.send_signal(SIGTERM)
83
 
84
 
85
  if __name__ == '__main__':
@@ -145,10 +146,10 @@ if __name__ == '__main__':
145
  value=speakers[0])
146
  vc_input2 = gr.Dropdown(label="Target Speaker", choices=speakers, type="index",
147
  value=speakers[1])
148
- vc_input3 = gr.Audio(label="Input Audio (20s limitation)")
149
  vc_submit = gr.Button("Convert", variant="primary")
150
  vc_output1 = gr.Textbox(label="Output Message")
151
  vc_output2 = gr.Audio(label="Output Audio")
152
  vc_submit.click(vc_fn, [vc_input1, vc_input2, vc_input3], [vc_output1, vc_output2])
153
  # app.launch()
154
- app.queue(concurrency_count=1, client_position_to_load_data=10).launch()
 
1
  import json
2
+ import signal
3
+ import sys
4
 
5
  import librosa
6
  import numpy as np
 
49
  return "You need to upload an audio", None
50
  sampling_rate, audio = input_audio
51
  duration = audio.shape[0] / sampling_rate
52
+ if limitation and duration > 15:
53
  return "Error: Audio is too long", None
54
  original_speaker_id = speaker_ids[original_speaker]
55
  target_speaker_id = speaker_ids[target_speaker]
 
80
  for proc in process_iter():
81
  for conns in proc.connections(kind='inet'):
82
  if conns.laddr.port == 7860:
83
+ proc.send_signal(signal.SIGTERM if sys.platform == "win32" else signal.SIGKILL)
84
 
85
 
86
  if __name__ == '__main__':
 
146
  value=speakers[0])
147
  vc_input2 = gr.Dropdown(label="Target Speaker", choices=speakers, type="index",
148
  value=speakers[1])
149
+ vc_input3 = gr.Audio(label="Input Audio (15s limitation)")
150
  vc_submit = gr.Button("Convert", variant="primary")
151
  vc_output1 = gr.Textbox(label="Output Message")
152
  vc_output2 = gr.Audio(label="Output Audio")
153
  vc_submit.click(vc_fn, [vc_input1, vc_input2, vc_input3], [vc_output1, vc_output2])
154
  # app.launch()
155
+ app.queue(concurrency_count=1, client_position_to_load_data=10).launch(max_threads=10)