yerang commited on
Commit
5a51b84
โ€ข
1 Parent(s): a2c05a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -1
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"