lengyue233 commited on
Commit
82d5f8b
1 Parent(s): 93ab4bd

fix ckpt downloading

Browse files
Files changed (2) hide show
  1. app.py +13 -3
  2. setup.sh +0 -18
app.py CHANGED
@@ -1,10 +1,20 @@
1
  import subprocess as sp
2
- import sys
 
 
 
 
 
 
 
3
 
4
- sp.check_call(["bash", "setup.sh"], shell=True, stdout=sys.stdout, stderr=sys.stderr)
 
 
 
 
5
 
6
  import html
7
- import os
8
  from argparse import ArgumentParser
9
  from io import BytesIO
10
  from pathlib import Path
 
1
  import subprocess as sp
2
+ import os
3
+
4
+ # Download if not exists
5
+ os.makedirs("checkpoints", exist_ok=True)
6
+
7
+ if not os.path.exists("checkpoints/text2semantic-medium-v1-2k.pth"):
8
+ print("Downloading text2semantic-medium-v1-2k.pth")
9
+ sp.run(["wget", "-O", "checkpoints/text2semantic-medium-v1-2k.pth", os.environ["CKPT_SEMANTIC"]])
10
 
11
+ if not os.path.exists("checkpoints/vq-gan-group-fsq-2x1024.pth"):
12
+ print("Downloading vq-gan-group-fsq-2x1024.pth")
13
+ sp.run(["wget", "-O", "checkpoints/vq-gan-group-fsq-2x1024.pth", os.environ["CKPT_VQGAN"]])
14
+
15
+ print("All checkpoints downloaded")
16
 
17
  import html
 
18
  from argparse import ArgumentParser
19
  from io import BytesIO
20
  from pathlib import Path
setup.sh DELETED
@@ -1,18 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- mkdir -p checkpoints
5
-
6
- if [ -e checkpoints/text2semantic-medium-v1-2k.pth ]; then
7
- echo "checkpoints/text2semantic-medium-v1-2k.pth already exists"
8
- else
9
- echo "Downloading text2semantic-medium-v1-2k.pth"
10
- wget -O checkpoints/text2semantic-medium-v1-2k.pth $CKPT_SEMANTIC
11
- fi
12
-
13
- if [ -e checkpoints/vq-gan-group-fsq-2x1024.pth ]; then
14
- echo "checkpoints/vq-gan-group-fsq-2x1024.pth already exists"
15
- else
16
- echo "Downloading vq-gan-group-fsq-2x1024.pth"
17
- wget -O checkpoints/vq-gan-group-fsq-2x1024.pth $CKPT_VQGAN
18
- fi