Limour's picture
Upload 2 files
6b70385 verified
raw
history blame
437 Bytes
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()