Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,4 @@
|
|
1 |
import os
|
2 |
-
if os.environ.get("SPACES_ZERO_GPU") is not None:
|
3 |
-
import spaces
|
4 |
-
else:
|
5 |
-
class spaces:
|
6 |
-
@staticmethod
|
7 |
-
def GPU(func):
|
8 |
-
def wrapper(*args, **kwargs):
|
9 |
-
return func(*args, **kwargs)
|
10 |
-
return wrapper
|
11 |
from sys import executable as pyexecutable
|
12 |
import subprocess
|
13 |
import pathlib
|
@@ -64,7 +55,7 @@ def Gitclone(URI:str,ClonePath:str = "",HASH:str = "") -> int :
|
|
64 |
del i
|
65 |
else:
|
66 |
while True:
|
67 |
-
i=subprocess.run([r"git",r"clone",URI,ClonePath])
|
68 |
try:
|
69 |
os.chdir(ClonePath)
|
70 |
if HASH: os.system(f"git reset --hard {HASH}")
|
@@ -84,7 +75,7 @@ def DownLoad(URI:str,DownloadPath:str,DownLoadFileName:str ) -> int:
|
|
84 |
success=download_hf_file(DownloadPath, URI)
|
85 |
if success: return 0
|
86 |
else:
|
87 |
-
i=subprocess.run([r"aria2c",r"-c",r"-x" ,r"16", r"-s",r"16", r"-k" ,r"1M" ,r"-m",r"0",r"--enable-mmap=false",r"--console-log-level=error",r"-d",DownloadPath,r"-o",DownLoadFileName,URI]);
|
88 |
if(i.returncode == 0 ):
|
89 |
del i
|
90 |
gc.collect()
|
|
|
1 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
from sys import executable as pyexecutable
|
3 |
import subprocess
|
4 |
import pathlib
|
|
|
55 |
del i
|
56 |
else:
|
57 |
while True:
|
58 |
+
i=subprocess.run([r"git",r"clone",URI,ClonePath], timeout=60)
|
59 |
try:
|
60 |
os.chdir(ClonePath)
|
61 |
if HASH: os.system(f"git reset --hard {HASH}")
|
|
|
75 |
success=download_hf_file(DownloadPath, URI)
|
76 |
if success: return 0
|
77 |
else:
|
78 |
+
i=subprocess.run([r"aria2c",r"-c",r"-x" ,r"16", r"-s",r"16", r"-k" ,r"1M" ,r"-m",r"0",r"--enable-mmap=false",r"--console-log-level=error",r"-d",DownloadPath,r"-o",DownLoadFileName,URI], timeout=60);
|
79 |
if(i.returncode == 0 ):
|
80 |
del i
|
81 |
gc.collect()
|