Spaces:
Sleeping
Sleeping
File size: 776 Bytes
a71f59a b607519 a71f59a b607519 a71f59a 2e3c4e2 dce517a 2e3c4e2 f6fe9bf 473c949 f6fe9bf b607519 f6fe9bf a65b44b |
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 |
import gradio as gr
import subprocess
from pathlib import Path
PIXI_PATH = Path("/home/user/.pixi/bin/pixi")
def check_and_install_pixi():
try:
subprocess.check_call("pixi --version", shell=True)
except subprocess.CalledProcessError:
print("pixi not found. Installing pixi...")
# Install pixi using the provided installation script
subprocess.check_call("curl -fsSL https://pixi.sh/install.sh | bash", shell=True)
def pixi_run():
command = f"{PIXI_PATH} run app"
subprocess.check_call(command, shell=True)
def check_port_and_kill():
command = "lsof -t -i:7860 | xargs -r kill"
subprocess.check_call(command, shell=True)
if __name__ == "__main__":
check_port_and_kill()
check_and_install_pixi()
pixi_run() |