TheEeeeLin commited on
Commit
be33c96
·
1 Parent(s): f8cafb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -6,6 +6,9 @@ from hivision.creator.choose_handler import HUMAN_MATTING_MODELS
6
 
7
  root_dir = os.path.dirname(os.path.abspath(__file__))
8
 
 
 
 
9
  HUMAN_MATTING_MODELS_EXIST = [
10
  os.path.splitext(file)[0]
11
  for file in os.listdir(os.path.join(root_dir, "hivision/creator/weights"))
@@ -28,6 +31,8 @@ FACE_DETECT_MODELS_EXPAND = (
28
  )
29
  FACE_DETECT_MODELS += FACE_DETECT_MODELS_EXPAND
30
 
 
 
31
  if __name__ == "__main__":
32
  argparser = argparse.ArgumentParser()
33
  argparser.add_argument(
@@ -47,7 +52,11 @@ if __name__ == "__main__":
47
  processor = IDPhotoProcessor()
48
 
49
  demo = create_ui(
50
- processor, root_dir, HUMAN_MATTING_MODELS_EXIST, FACE_DETECT_MODELS
 
 
 
 
51
  )
52
  demo.launch(
53
  # server_name=args.host,
 
6
 
7
  root_dir = os.path.dirname(os.path.abspath(__file__))
8
 
9
+ # 获取存在的人像分割模型列表
10
+ # 通过检查 hivision/creator/weights 目录下的 .onnx 和 .mnn 文件
11
+ # 只保留文件名(不包括扩展名)
12
  HUMAN_MATTING_MODELS_EXIST = [
13
  os.path.splitext(file)[0]
14
  for file in os.listdir(os.path.join(root_dir, "hivision/creator/weights"))
 
31
  )
32
  FACE_DETECT_MODELS += FACE_DETECT_MODELS_EXPAND
33
 
34
+ LANGUAGE = ["zh", "en", "ko", "ja"]
35
+
36
  if __name__ == "__main__":
37
  argparser = argparse.ArgumentParser()
38
  argparser.add_argument(
 
52
  processor = IDPhotoProcessor()
53
 
54
  demo = create_ui(
55
+ processor,
56
+ root_dir,
57
+ HUMAN_MATTING_MODELS_EXIST,
58
+ FACE_DETECT_MODELS,
59
+ LANGUAGE,
60
  )
61
  demo.launch(
62
  # server_name=args.host,