Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,10 @@
|
|
| 1 |
import json
|
|
|
|
|
|
|
| 2 |
import librosa
|
| 3 |
import numpy as np
|
| 4 |
import torch
|
|
|
|
| 5 |
from torch import no_grad, LongTensor
|
| 6 |
import commons
|
| 7 |
import utils
|
|
@@ -72,6 +75,13 @@ def create_vc_fn(model, hps, speaker_ids):
|
|
| 72 |
return vc_fn
|
| 73 |
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
if __name__ == '__main__':
|
| 76 |
models = []
|
| 77 |
with open("saved_model/names.json", "r", encoding="utf-8") as f:
|
|
@@ -137,5 +147,6 @@ if __name__ == '__main__':
|
|
| 137 |
vc_output2 = gr.Audio(label="Output Audio")
|
| 138 |
vc_submit.click(vc_fn, [vc_input1, vc_input2, vc_input3], [vc_output1, vc_output2])
|
| 139 |
|
|
|
|
| 140 |
# app.launch()
|
| 141 |
app.queue(client_position_to_load_data=10).launch()
|
|
|
|
| 1 |
import json
|
| 2 |
+
from signal import SIGTERM
|
| 3 |
+
|
| 4 |
import librosa
|
| 5 |
import numpy as np
|
| 6 |
import torch
|
| 7 |
+
from psutil import process_iter
|
| 8 |
from torch import no_grad, LongTensor
|
| 9 |
import commons
|
| 10 |
import utils
|
|
|
|
| 75 |
return vc_fn
|
| 76 |
|
| 77 |
|
| 78 |
+
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__':
|
| 86 |
models = []
|
| 87 |
with open("saved_model/names.json", "r", encoding="utf-8") as f:
|
|
|
|
| 147 |
vc_output2 = gr.Audio(label="Output Audio")
|
| 148 |
vc_submit.click(vc_fn, [vc_input1, vc_input2, vc_input3], [vc_output1, vc_output2])
|
| 149 |
|
| 150 |
+
kill_proc()
|
| 151 |
# app.launch()
|
| 152 |
app.queue(client_position_to_load_data=10).launch()
|