Spaces:
Sleeping
Sleeping
divimund95
commited on
Commit
•
ba3e3be
1
Parent(s):
d911050
configure for HF spaces
Browse files- app.py +3 -0
- packages.txt +3 -0
- requirements.txt +2 -0
- setup.sh +16 -12
- setup_local.sh +14 -0
app.py
CHANGED
@@ -5,6 +5,9 @@ from PIL import Image
|
|
5 |
import io
|
6 |
from omegaconf import OmegaConf
|
7 |
|
|
|
|
|
|
|
8 |
import sys
|
9 |
import os
|
10 |
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lama'))
|
|
|
5 |
import io
|
6 |
from omegaconf import OmegaConf
|
7 |
|
8 |
+
import subprocess
|
9 |
+
rc = subprocess.call("./setup.sh")
|
10 |
+
|
11 |
import sys
|
12 |
import os
|
13 |
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lama'))
|
packages.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
git
|
2 |
+
curl
|
3 |
+
unzip
|
requirements.txt
CHANGED
@@ -19,3 +19,5 @@ kornia==0.5.0
|
|
19 |
webdataset
|
20 |
packaging
|
21 |
wldhx.yadisk-direct
|
|
|
|
|
|
19 |
webdataset
|
20 |
packaging
|
21 |
wldhx.yadisk-direct
|
22 |
+
torch
|
23 |
+
torchvision
|
setup.sh
CHANGED
@@ -1,14 +1,18 @@
|
|
1 |
-
|
2 |
-
conda activate cleanup
|
3 |
-
# conda install pytorch==1.9.0 torchvision==0.10.0 cudatoolkit=11.1 -c pytorch -c nvidia
|
4 |
-
conda install pytorch torchvision -c pytorch -y
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
1 |
+
#!/bin/bash
|
|
|
|
|
|
|
2 |
|
3 |
+
# Check if lama directory exists
|
4 |
+
if [ ! -d "lama" ]; then
|
5 |
+
# Clone dependency repos
|
6 |
+
git clone https://github.com/advimman/lama.git
|
7 |
+
else
|
8 |
+
echo "lama directory already exists. Skipping clone."
|
9 |
+
fi
|
10 |
|
11 |
+
# Check if big-lama.zip or big-lama directory exists
|
12 |
+
if [ ! -f "big-lama.zip" ] && [ ! -d "big-lama" ]; then
|
13 |
+
# Download big-lama model
|
14 |
+
curl -LJO https://huggingface.co/smartywu/big-lama/resolve/main/big-lama.zip
|
15 |
+
unzip big-lama.zip
|
16 |
+
else
|
17 |
+
echo "big-lama model already exists. Skipping download and extraction."
|
18 |
+
fi
|
setup_local.sh
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
conda create -n cleanup python=3.10 -y
|
2 |
+
conda activate cleanup
|
3 |
+
# conda install pytorch==1.9.0 torchvision==0.10.0 cudatoolkit=11.1 -c pytorch -c nvidia
|
4 |
+
conda install pytorch torchvision -c pytorch -y
|
5 |
+
|
6 |
+
pip install -r requirements.txt
|
7 |
+
|
8 |
+
|
9 |
+
# Clone dependency repos
|
10 |
+
git clone https://github.com/advimman/lama.git
|
11 |
+
|
12 |
+
# Download big-lama model
|
13 |
+
curl -LJO https://huggingface.co/smartywu/big-lama/resolve/main/big-lama.zip
|
14 |
+
unzip big-lama.zip
|