hsuwill000 commited on
Commit
5177727
·
verified ·
1 Parent(s): 3bde190

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -14
app.py CHANGED
@@ -1,20 +1,47 @@
1
  import os
2
  import sys
3
-
4
- import gradio as gr
5
- import numpy as np
6
- import random
7
  import shutil
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
- '''
10
- if not os.path.exists("sd-ggml-cpp-dp"):
11
- os.system("git clone https://huggingface.co/svjack/sd-ggml-cpp-dp")
12
- else:
13
- shutil.rmtree("sd-ggml-cpp-dp")
14
- os.system("git clone https://huggingface.co/svjack/sd-ggml-cpp-dp")
15
- assert os.path.exists("sd-ggml-cpp-dp")
16
- '''
17
 
 
18
 
19
- os.system("apt-get install libopenblas-base")
20
- os.system("pip install huggingface_hub")
 
1
  import os
2
  import sys
 
 
 
 
3
  import shutil
4
+ import subprocess
5
+
6
+ def install_openblas_and_huggingface_hub():
7
+ # Step 1: Install OpenBLAS base using apt-get
8
+ try:
9
+ print("Installing libopenblas-base...")
10
+ os.system("sudo apt-get update && sudo apt-get install -y libopenblas-base")
11
+ except Exception as e:
12
+ print(f"Error installing libopenblas-base: {e}")
13
+ sys.exit(1)
14
+
15
+ # Step 2: Install huggingface_hub Python package using pip
16
+ try:
17
+ print("Installing huggingface_hub Python package...")
18
+ os.system("pip install huggingface_hub")
19
+ except Exception as e:
20
+ print(f"Error installing huggingface_hub: {e}")
21
+ sys.exit(1)
22
+
23
+ def clone_repo():
24
+ repo_url = "https://huggingface.co/svjack/sd-ggml-cpp-dp"
25
+ repo_dir = "sd-ggml-cpp-dp"
26
+
27
+ if not os.path.exists(repo_dir):
28
+ print(f"Cloning repository from {repo_url}...")
29
+ os.system(f"git clone {repo_url}")
30
+ else:
31
+ print(f"Removing existing repository {repo_dir} and cloning again...")
32
+ shutil.rmtree(repo_dir)
33
+ os.system(f"git clone {repo_url}")
34
+
35
+ assert os.path.exists(repo_dir), "Failed to clone repository!"
36
+
37
+ def main():
38
+ # Install necessary packages
39
+ install_openblas_and_huggingface_hub()
40
 
41
+ # Clone repository
42
+ clone_repo()
 
 
 
 
 
 
43
 
44
+ print("Setup complete!")
45
 
46
+ if __name__ == "__main__":
47
+ main()