Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import torch
|
|
4 |
import gdown
|
5 |
import os
|
6 |
import setup_environment
|
|
|
|
|
7 |
|
8 |
zero = torch.Tensor([0]).cuda()
|
9 |
print(zero.device) # <-- 'cpu' ๐ค
|
@@ -20,8 +22,37 @@ def greet(n):
|
|
20 |
url = f"https://drive.google.com/uc?id={file_id}"
|
21 |
|
22 |
# ํ์ผ ๋ค์ด๋ก๋
|
23 |
-
gdown.download(url, '/tmp/', quiet=False)
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
|
27 |
return f"Hello {zero + n} Tensor"
|
|
|
4 |
import gdown
|
5 |
import os
|
6 |
import setup_environment
|
7 |
+
import zipfile
|
8 |
+
from setup_environment import initialize_environment
|
9 |
|
10 |
zero = torch.Tensor([0]).cuda()
|
11 |
print(zero.device) # <-- 'cpu' ๐ค
|
|
|
22 |
url = f"https://drive.google.com/uc?id={file_id}"
|
23 |
|
24 |
# ํ์ผ ๋ค์ด๋ก๋
|
25 |
+
gdown.download(url, '/tmp/stf.zip', quiet=False)
|
26 |
|
27 |
+
dir_zip= os.path.join(root_path, '/tmp/stf.zip')
|
28 |
+
dir_target=os.path.join(root_path,'/tmp/')
|
29 |
+
zipfile.ZipFile(dir_zip, 'r').extractall(dir_target)
|
30 |
+
|
31 |
+
|
32 |
+
initialize_environment()
|
33 |
+
|
34 |
+
|
35 |
+
sys.path.append('/home/user/.local/lib/python3.10/site-packages')
|
36 |
+
sys.path.append('/home/user/.local/lib/python3.10/site-packages/stf_alternative/src/stf_alternative')
|
37 |
+
sys.path.append('/home/user/.local/lib/python3.10/site-packages/stf_tools/src/stf_tools')
|
38 |
+
sys.path.append('/tmp/')
|
39 |
+
sys.path.append('/tmp/stf/')
|
40 |
+
sys.path.append('/tmp/stf/stf_alternative/')
|
41 |
+
sys.path.append('/tmp/stf/stf_alternative/src/stf_alternative')
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
# CUDA ๊ฒฝ๋ก๋ฅผ ํ๊ฒฝ ๋ณ์๋ก ์ค์
|
46 |
+
os.environ['PATH'] = '/usr/local/cuda/bin:' + os.environ.get('PATH', '')
|
47 |
+
os.environ['LD_LIBRARY_PATH'] = '/usr/local/cuda/lib64:' + os.environ.get('LD_LIBRARY_PATH', '')
|
48 |
+
# ํ์ธ์ฉ ์ถ๋ ฅ
|
49 |
+
print("PATH:", os.environ['PATH'])
|
50 |
+
print("LD_LIBRARY_PATH:", os.environ['LD_LIBRARY_PATH'])
|
51 |
+
|
52 |
+
from stf_utils import STFPipeline
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
|
57 |
|
58 |
return f"Hello {zero + n} Tensor"
|