FlawedLLM commited on
Commit
22703ff
·
verified ·
1 Parent(s): a17c9e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -1,6 +1,19 @@
1
 
2
  # from huggingface_hub import login, HfFolder
3
  import subprocess
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  def run_command(cmd, shell=False):
5
  """Runs a shell command and prints the output."""
6
  try:
 
1
 
2
  # from huggingface_hub import login, HfFolder
3
  import subprocess
4
+ import getpass
5
+
6
+ def run_sudo_command(cmd):
7
+ try:
8
+ password = getpass.getpass(prompt="Enter your sudo password: ") # Securely get the password
9
+ result = subprocess.run(["sudo", "-S"] + cmd, input=password.encode(), capture_output=True, text=True, check=True)
10
+ print(result.stdout)
11
+ except subprocess.CalledProcessError as e:
12
+ print(f"Error executing command: {e.stderr}")
13
+
14
+ # Run the ldconfig command
15
+ run_sudo_command(["ldconfig", "/usr/lib64-nvidia"])
16
+
17
  def run_command(cmd, shell=False):
18
  """Runs a shell command and prints the output."""
19
  try: