Spaces:
Runtime error
Runtime error
update: revise download logic
Browse files
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 |
-
|
9 |
-
subprocess.
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|