Spaces:
Running
Running
File size: 911 Bytes
86a1ccb 8b14ef8 86a1ccb 8b14ef8 3a61333 c45428a 86a1ccb c45428a 8b14ef8 c45428a 86a1ccb 8b14ef8 c45428a 8b14ef8 86a1ccb 3a61333 8b14ef8 c45428a 8b14ef8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import os
import sys
import subprocess
from loguru import logger
def setup_and_run():
repo_url = "https://github.com/renkexuan369/INF-MLLM.git"
clone_dir = "INF-MLLM"
repo_dir = "INF-MLLM/Infinity-Parser2/infinity_parser2"
if not os.path.exists(clone_dir):
logger.info(f"clone: {repo_url}")
subprocess.run(["git", "clone", repo_url], check=True)
else:
logger.info("pulling...")
subprocess.run(["git", "pull"], cwd=clone_dir, check=True)
os.environ['GRADIO_SSR_MODE'] = "false"
os.environ["GRADIO_SERVER_PORT"] = "7860"
os.environ["GRADIO_SERVER_NAME"] = "0.0.0.0"
logger.info("run inf_gradio.py ...")
try:
subprocess.run([sys.executable, "gradio_app.py"], cwd=repo_dir, check=True)
except subprocess.CalledProcessError as e:
logger.error(f"Gradio exit: {e}")
if __name__ == "__main__":
setup_and_run() |