mirror of
https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-06-12 06:00:23 +08:00
optimize(web): program cleanup on exit
This commit is contained in:
12
infer-web.py
12
infer-web.py
@@ -1638,7 +1638,15 @@ with gr.Blocks(title="RVC WebUI") as app:
|
||||
except:
|
||||
gr.Markdown(traceback.format_exc())
|
||||
|
||||
try:
|
||||
try:
|
||||
import signal
|
||||
def cleanup(signum, frame):
|
||||
signame = signal.Signals(signum).name
|
||||
print(f'Got signal {signame} ({signum})')
|
||||
app.close()
|
||||
sys.exit(0)
|
||||
signal.signal(signal.SIGINT, cleanup)
|
||||
signal.signal(signal.SIGTERM, cleanup)
|
||||
if config.iscolab:
|
||||
app.queue(max_size=1022).launch(share=True, max_threads=511)
|
||||
else:
|
||||
@@ -1649,5 +1657,5 @@ with gr.Blocks(title="RVC WebUI") as app:
|
||||
server_port=config.listen_port,
|
||||
quiet=True,
|
||||
)
|
||||
except Exception as e:
|
||||
except Exception as e:
|
||||
logger.error(str(e))
|
||||
|
||||
Reference in New Issue
Block a user