mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-05-06 20:01:37 +08:00
optimize(web): program cleanup on exit
This commit is contained in:
parent
0f36233017
commit
bd0b43f7e6
12
infer-web.py
12
infer-web.py
@ -1638,7 +1638,15 @@ with gr.Blocks(title="RVC WebUI") as app:
|
|||||||
except:
|
except:
|
||||||
gr.Markdown(traceback.format_exc())
|
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:
|
if config.iscolab:
|
||||||
app.queue(max_size=1022).launch(share=True, max_threads=511)
|
app.queue(max_size=1022).launch(share=True, max_threads=511)
|
||||||
else:
|
else:
|
||||||
@ -1649,5 +1657,5 @@ with gr.Blocks(title="RVC WebUI") as app:
|
|||||||
server_port=config.listen_port,
|
server_port=config.listen_port,
|
||||||
quiet=True,
|
quiet=True,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(str(e))
|
logger.error(str(e))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user