Hyeonseo commited on
Commit
3c287db
β€’
1 Parent(s): 27ab40a

update: revise download logic

Browse files
Files changed (1) hide show
  1. presentation_assistant/env_set.py +20 -5
presentation_assistant/env_set.py CHANGED
@@ -5,11 +5,26 @@ import sys
5
  sys.path.append("/home/user/app")
6
 
7
  def env_set():
8
- subprocess.run(f"pip install PyPDF2", shell=True)
9
- subprocess.run(f"pip install -q openai", shell=True)
10
- subprocess.run(f"pip install python-pptx", shell=True)
11
- subprocess.run(f"chmod +x ./pandoc-2.14.2/bin/pandoc", shell=True)
12
- subprocess.run(f"chmod -R 777 .", shell=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  # subprocess.run(f"wget https://github.com/jgm/pandoc/releases/download/2.14.2/pandoc-2.14.2-linux-amd64.tar.gz", shell=True)
14
  # subprocess.run(f"tar -xvf pandoc-2.14.2-linux-amd64.tar.gz", shell=True)
15
  # subprocess.run(f"wget https://nodejs.org/dist/v17.0.1/node-v17.0.1-linux-x64.tar.xz", shell=True)
 
5
  sys.path.append("/home/user/app")
6
 
7
  def env_set():
8
+ # νŒ¨ν‚€μ§€κ°€ 이미 μ„€μΉ˜λ˜μ–΄ μžˆλŠ”μ§€ 확인
9
+ installed_packages = subprocess.check_output("pip list", shell=True).decode()
10
+
11
+ if "PyPDF2" not in installed_packages:
12
+ subprocess.run(f"pip install PyPDF2", shell=True)
13
+
14
+ if "openai" not in installed_packages:
15
+ subprocess.run(f"pip install -q openai", shell=True)
16
+
17
+ if "python-pptx" not in installed_packages:
18
+ subprocess.run(f"pip install python-pptx", shell=True)
19
+
20
+ # pandoc μ‹€ν–‰ κΆŒν•œ μ„€μ •
21
+ if not os.access("./pandoc-2.14.2/bin/pandoc", os.X_OK):
22
+ subprocess.run(f"chmod +x ./pandoc-2.14.2/bin/pandoc", shell=True)
23
+
24
+ # 디렉토리 κΆŒν•œ μ„€μ •
25
+ if not os.access(".", os.W_OK):
26
+ subprocess.run(f"chmod -R 777 .", shell=True)
27
+
28
  # subprocess.run(f"wget https://github.com/jgm/pandoc/releases/download/2.14.2/pandoc-2.14.2-linux-amd64.tar.gz", shell=True)
29
  # subprocess.run(f"tar -xvf pandoc-2.14.2-linux-amd64.tar.gz", shell=True)
30
  # subprocess.run(f"wget https://nodejs.org/dist/v17.0.1/node-v17.0.1-linux-x64.tar.xz", shell=True)