Zevin2023 commited on
Commit
effd827
·
1 Parent(s): 68cea8b

add online demo

Browse files
Files changed (1) hide show
  1. app.py +15 -18
app.py CHANGED
@@ -1,50 +1,47 @@
1
- import subprocess
2
- import sys
3
- def run_command(command):
4
- subprocess.check_call([sys.executable, '-m'] + command.split(), shell=False)
5
 
6
  if __name__ == '__main__':
7
  # Install the package in editable mode
8
- run_command("pip install -e .")
9
 
10
  # Install NVM (Node Version Manager)
11
- run_command("curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash")
12
 
13
  # Source the appropriate shell configuration file
14
- run_command("source ~/.bashrc") # You can change to ~/.zshrc based on your shell
15
 
16
  # Install Node.js version 18.16.0
17
- run_command("nvm install v18.16.0")
18
 
19
  # Install pnpm (package manager)
20
- run_command("curl -fsSL https://get.pnpm.io/install.sh | sh -")
21
 
22
  # Source the shell configuration file again (for pnpm)
23
- run_command("source ~/.bashrc") # You can change to ~/.zshrc based on your shell
24
 
25
  # Verify if pnpm was installed correctly
26
- run_command("pnpm --version")
27
 
28
  # Clone the Gradio BBox repository
29
- run_command("git clone https://github.com/chencn2020/gradio-bbox.git")
30
 
31
  # Change into the cloned repository directory
32
- run_command("cd gradio-bbox")
33
 
34
  # Build frontend
35
- run_command("bash scripts/build_frontend.sh")
36
 
37
  # Change back to the previous directory
38
- run_command("cd ..")
39
 
40
  # Install the package again in editable mode
41
- run_command("pip install -e .")
42
 
43
  # Install Segment Anything repository from GitHub
44
- run_command("pip install git+https://github.com/facebookresearch/segment-anything.git")
45
 
46
  # Download the model checkpoint
47
- run_command("curl -o ./checkpoints/sam_vit_b_01ec64.pth https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth")
48
 
49
  import argparse
50
  from demo.UI import Main_ui
 
1
+ import os
 
 
 
2
 
3
  if __name__ == '__main__':
4
  # Install the package in editable mode
5
+ os.system("pip install -e .")
6
 
7
  # Install NVM (Node Version Manager)
8
+ os.system("curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash")
9
 
10
  # Source the appropriate shell configuration file
11
+ os.system("source ~/.bashrc") # You can change to ~/.zshrc based on your shell
12
 
13
  # Install Node.js version 18.16.0
14
+ os.system("nvm install v18.16.0")
15
 
16
  # Install pnpm (package manager)
17
+ os.system("curl -fsSL https://get.pnpm.io/install.sh | sh -")
18
 
19
  # Source the shell configuration file again (for pnpm)
20
+ os.system("source ~/.bashrc") # You can change to ~/.zshrc based on your shell
21
 
22
  # Verify if pnpm was installed correctly
23
+ os.system("pnpm --version")
24
 
25
  # Clone the Gradio BBox repository
26
+ os.system("git clone https://github.com/chencn2020/gradio-bbox.git")
27
 
28
  # Change into the cloned repository directory
29
+ os.system("cd gradio-bbox")
30
 
31
  # Build frontend
32
+ os.system("bash scripts/build_frontend.sh")
33
 
34
  # Change back to the previous directory
35
+ os.system("cd ..")
36
 
37
  # Install the package again in editable mode
38
+ os.system("pip install -e .")
39
 
40
  # Install Segment Anything repository from GitHub
41
+ os.system("pip install git+https://github.com/facebookresearch/segment-anything.git")
42
 
43
  # Download the model checkpoint
44
+ os.system("curl -o ./checkpoints/sam_vit_b_01ec64.pth https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth")
45
 
46
  import argparse
47
  from demo.UI import Main_ui