Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,28 @@
|
|
| 1 |
import os
|
| 2 |
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Clone the GitHub repository
|
| 5 |
os.system("git clone https://github.com/oobabooga/text-generation-webui.git")
|
|
|
|
| 1 |
import os
|
| 2 |
import subprocess
|
| 3 |
+
import platform
|
| 4 |
+
|
| 5 |
+
# Function to install Node.js and npm if not found
|
| 6 |
+
def install_nodejs_npm():
|
| 7 |
+
system = platform.system().lower()
|
| 8 |
+
if system == "linux":
|
| 9 |
+
os.system("sudo apt update")
|
| 10 |
+
os.system("sudo apt install -y nodejs npm")
|
| 11 |
+
elif system == "darwin":
|
| 12 |
+
os.system("brew install node")
|
| 13 |
+
elif system == "windows":
|
| 14 |
+
# You can provide instructions for Windows users to install Node.js manually
|
| 15 |
+
print("Please install Node.js and npm manually for Windows.")
|
| 16 |
+
else:
|
| 17 |
+
print("Unsupported operating system. Please install Node.js and npm manually for your system.")
|
| 18 |
+
|
| 19 |
+
# Check if Node.js and npm are installed
|
| 20 |
+
try:
|
| 21 |
+
subprocess.check_call(["node", "-v"])
|
| 22 |
+
subprocess.check_call(["npm", "-v"])
|
| 23 |
+
except FileNotFoundError:
|
| 24 |
+
print("Node.js or npm not found. Installing Node.js and npm...")
|
| 25 |
+
install_nodejs_npm()
|
| 26 |
|
| 27 |
# Clone the GitHub repository
|
| 28 |
os.system("git clone https://github.com/oobabooga/text-generation-webui.git")
|