Spaces:
Sleeping
Sleeping
File size: 437 Bytes
6b70385 bac870d 6b70385 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import subprocess
from hf_api import restart_space
try:
# 启动另一个程序,并通过管道捕获其输出
process = subprocess.Popen(["python", "sub_app.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
while True:
output = process.stdout.readline()
if output:
print(output.decode("utf-8").strip())
if process.poll() is not None:
break
finally:
restart_space()
|