Sofian Hadiwijaya commited on
Commit
95652ea
1 Parent(s): e11dc12

try to install mmcv inside app

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -29,7 +29,24 @@ from musetalk.utils.preprocessing import get_landmark_and_bbox,read_imgs,coord_p
29
  from musetalk.utils.blending import get_image
30
  from musetalk.utils.utils import load_all_model
31
 
 
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  ProjectDir = os.path.abspath(os.path.dirname(__file__))
35
  CheckpointsDir = os.path.join(ProjectDir, "checkpoints")
 
29
  from musetalk.utils.blending import get_image
30
  from musetalk.utils.utils import load_all_model
31
 
32
+ import subprocess
33
 
34
+ # Function to install dependencies
35
+ def install_dependencies():
36
+ try:
37
+ # Run the pip install commands one by one
38
+ subprocess.run("pip install --no-cache-dir -U openmim", shell=True, check=True)
39
+ subprocess.run("mim install mmengine", shell=True, check=True)
40
+ subprocess.run('mim install "mmcv>=2.0.1"', shell=True, check=True)
41
+ subprocess.run('mim install "mmdet>=3.1.0"', shell=True, check=True)
42
+ subprocess.run('mim install "mmpose>=1.1.0"', shell=True, check=True)
43
+ print("All dependencies installed successfully!")
44
+ except subprocess.CalledProcessError as e:
45
+ print(f"An error occurred: {e}")
46
+ exit(1)
47
+
48
+ # Call this function before starting the Gradio app
49
+ install_dependencies()
50
 
51
  ProjectDir = os.path.abspath(os.path.dirname(__file__))
52
  CheckpointsDir = os.path.join(ProjectDir, "checkpoints")