add online demo
Browse files
app.py
CHANGED
@@ -1,50 +1,47 @@
|
|
1 |
-
import
|
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 |
-
|
9 |
|
10 |
# Install NVM (Node Version Manager)
|
11 |
-
|
12 |
|
13 |
# Source the appropriate shell configuration file
|
14 |
-
|
15 |
|
16 |
# Install Node.js version 18.16.0
|
17 |
-
|
18 |
|
19 |
# Install pnpm (package manager)
|
20 |
-
|
21 |
|
22 |
# Source the shell configuration file again (for pnpm)
|
23 |
-
|
24 |
|
25 |
# Verify if pnpm was installed correctly
|
26 |
-
|
27 |
|
28 |
# Clone the Gradio BBox repository
|
29 |
-
|
30 |
|
31 |
# Change into the cloned repository directory
|
32 |
-
|
33 |
|
34 |
# Build frontend
|
35 |
-
|
36 |
|
37 |
# Change back to the previous directory
|
38 |
-
|
39 |
|
40 |
# Install the package again in editable mode
|
41 |
-
|
42 |
|
43 |
# Install Segment Anything repository from GitHub
|
44 |
-
|
45 |
|
46 |
# Download the model checkpoint
|
47 |
-
|
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
|