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

get torch version

Browse files
Files changed (2) hide show
  1. app.py +0 -19
  2. musetalk/utils/utils.py +20 -0
app.py CHANGED
@@ -29,25 +29,6 @@ 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
- 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")
53
 
 
29
  from musetalk.utils.blending import get_image
30
  from musetalk.utils.utils import load_all_model
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ProjectDir = os.path.abspath(os.path.dirname(__file__))
33
  CheckpointsDir = os.path.join(ProjectDir, "checkpoints")
34
 
musetalk/utils/utils.py CHANGED
@@ -2,17 +2,37 @@ import os
2
  import cv2
3
  import numpy as np
4
  import torch
 
5
 
6
  current_dir = os.getcwd()
7
  parent_dir = os.path.dirname(os.path.dirname(current_dir))
8
 
9
  os.environ["FFMPEG_PATH"] = f"{parent_dir}/ffmpeg-7.0.2-amd64-static"
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ffmpeg_path = os.getenv('FFMPEG_PATH')
12
  if ffmpeg_path is None:
13
  print("please download ffmpeg-static and export to FFMPEG_PATH. \nFor example: export FFMPEG_PATH=/musetalk/ffmpeg-4.4-amd64-static")
14
  elif ffmpeg_path not in os.getenv('PATH'):
15
  print("add ffmpeg to path")
 
 
16
  os.environ["PATH"] = f"{ffmpeg_path}:{os.environ['PATH']}"
17
 
18
 
 
2
  import cv2
3
  import numpy as np
4
  import torch
5
+ import subprocess
6
 
7
  current_dir = os.getcwd()
8
  parent_dir = os.path.dirname(os.path.dirname(current_dir))
9
 
10
  os.environ["FFMPEG_PATH"] = f"{parent_dir}/ffmpeg-7.0.2-amd64-static"
11
 
12
+ # Function to install dependencies
13
+ def install_dependencies():
14
+ try:
15
+ # Run the pip install commands one by one
16
+ subprocess.run("pip install --no-cache-dir -U openmim", shell=True, check=True)
17
+ subprocess.run("mim install mmengine", shell=True, check=True)
18
+ subprocess.run('mim install "mmcv>=2.0.1"', shell=True, check=True)
19
+ subprocess.run('mim install "mmdet>=3.1.0"', shell=True, check=True)
20
+ subprocess.run('mim install "mmpose>=1.1.0"', shell=True, check=True)
21
+ print("All dependencies installed successfully!")
22
+ except subprocess.CalledProcessError as e:
23
+ print(f"An error occurred: {e}")
24
+ exit(1)
25
+
26
+ # Call this function before starting the Gradio app
27
+ install_dependencies()
28
+
29
  ffmpeg_path = os.getenv('FFMPEG_PATH')
30
  if ffmpeg_path is None:
31
  print("please download ffmpeg-static and export to FFMPEG_PATH. \nFor example: export FFMPEG_PATH=/musetalk/ffmpeg-4.4-amd64-static")
32
  elif ffmpeg_path not in os.getenv('PATH'):
33
  print("add ffmpeg to path")
34
+ print(f"torch version : {torch.__version__}")
35
+ print(f"torch cuda version : {torch.version.cuda}")
36
  os.environ["PATH"] = f"{ffmpeg_path}:{os.environ['PATH']}"
37
 
38