owiedotch commited on
Commit
a3550b7
1 Parent(s): 33da899

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -8,6 +8,7 @@ from omegaconf import OmegaConf
8
  import subprocess
9
  from tqdm import tqdm
10
  import requests
 
11
 
12
  def download_file(url, filename):
13
  response = requests.get(url, stream=True)
@@ -25,9 +26,27 @@ def download_file(url, filename):
25
  progress_bar.update(size)
26
 
27
  def setup_environment():
28
- if not os.path.exists("CCSR"):
29
  print("Cloning CCSR repository...")
30
- subprocess.run(["git", "clone", "-b", "dev", "https://github.com/camenduru/CCSR.git", "."])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  sys.path.append(os.getcwd())
33
 
 
8
  import subprocess
9
  from tqdm import tqdm
10
  import requests
11
+ import shutil
12
 
13
  def download_file(url, filename):
14
  response = requests.get(url, stream=True)
 
26
  progress_bar.update(size)
27
 
28
  def setup_environment():
29
+ if not os.path.exists("CCSR_temp"):
30
  print("Cloning CCSR repository...")
31
+ subprocess.run(["git", "clone", "-b", "dev", "https://github.com/camenduru/CCSR.git", "CCSR_temp"])
32
+ else:
33
+ print("CCSR repository already cloned. Skipping clone step.")
34
+
35
+ # Move necessary files/directories from CCSR_temp to current directory
36
+ for item in os.listdir("CCSR_temp"):
37
+ s = os.path.join("CCSR_temp", item)
38
+ d = os.path.join(os.getcwd(), item)
39
+ if os.path.isdir(s):
40
+ if os.path.exists(d):
41
+ shutil.rmtree(d)
42
+ shutil.move(s, d)
43
+ else:
44
+ if os.path.exists(d):
45
+ os.remove(d)
46
+ shutil.move(s, d)
47
+
48
+ # Clean up the temporary directory
49
+ shutil.rmtree("CCSR_temp")
50
 
51
  sys.path.append(os.getcwd())
52