pablovela5620 commited on
Commit
b607519
1 Parent(s): a71f59a

add pixi check and install

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import gradio as gr
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import subprocess
3
+ from pathlib import Path
4
+ PIXI_PATH = Path("/home/user/.pixi/bin/pixi")
5
 
6
+ def check_and_install_pixi():
7
+ try:
8
+ subprocess.check_call("pixi --version", shell=True)
9
+ except subprocess.CalledProcessError:
10
+ print("pixi not found. Installing pixi...")
11
+ # Install pixi using the provided installation script
12
+ subprocess.check_call("curl -fsSL https://pixi.sh/install.sh | bash", shell=True)
13
 
14
+ if __name__ == "__main__":
15
+ check_and_install_pixi()
16
+
17
+ def greet(name):
18
+ return "Hello " + name + "!!"
19
+
20
+ demo = gr.Interface(fn=greet, inputs="text", outputs="text")
21
+ demo.launch()