Applio21 / tabs /settings /restart.py
Aitron Emper
Upload 74 files
1a7d583 verified
raw
history blame
872 Bytes
import gradio as gr
import os
import sys
now_dir = os.getcwd()
pid_file_path = os.path.join(now_dir, "rvc", "train", "train_pid.txt")
def restart_applio():
if os.name != "nt":
os.system("clear")
else:
os.system("cls")
try:
with open(pid_file_path, "r") as pid_file:
pids = [int(pid) for pid in pid_file.readlines()]
for pid in pids:
os.kill(pid, 9)
os.remove(pid_file_path)
except:
pass
python = sys.executable
os.execl(python, python, *sys.argv)
from assets.i18n.i18n import I18nAuto
i18n = I18nAuto()
def restart_tab():
with gr.Row():
with gr.Column():
restart_button = gr.Button(i18n("Restart Applio"))
restart_button.click(
fn=restart_applio,
inputs=[],
outputs=[],
)