gaotingquan 1 tahun lalu
induk
melakukan
1ce57e8d8c
2 mengubah file dengan 8 tambahan dan 10 penghapusan
  1. 3 2
      paddlex/paddlex_cli.py
  2. 5 8
      paddlex/utils/interactive_get_pipeline.py

+ 3 - 2
paddlex/paddlex_cli.py

@@ -65,6 +65,7 @@ def args_cfg():
     parser.add_argument("--input", type=str, default=None, help="")
     parser.add_argument("--save_path", type=str, default=None, help="")
     parser.add_argument("--device", type=str, default=None, help="")
+    parser.add_argument("--get_pipeline_config", type=str, default=None, help="")
 
     return parser.parse_args()
 
@@ -107,8 +108,8 @@ def main():
     if args.install:
         install(args)
     else:
-        if args.input is None:
-            interactive_get_pipeline(args.pipeline)
+        if args.get_pipeline_config is not None:
+            interactive_get_pipeline(args.get_pipeline_config)
         else:
             return pipeline_predict(
                 args.pipeline,

+ 5 - 8
paddlex/utils/interactive_get_pipeline.py

@@ -23,12 +23,10 @@ def interactive_get_pipeline(pipeline):
     file_path = get_pipeline_path(pipeline)
     file_name = Path(file_path).name
 
-    target_path = (
-        input(
-            "Please enter the path that you want to save the pipeline config file: (default `./`)\n"
-        )
-        or "."
+    logging.info(
+        "Please enter the path that you want to save the pipeline config file: (default `./`)"
     )
+    target_path = input() or "."
     target_path = Path(target_path)
 
     if not target_path.suffix in (".yaml", ".yml"):
@@ -41,9 +39,8 @@ def interactive_get_pipeline(pipeline):
         target_path = target_path / file_name
 
     if target_path.exists():
-        overwrite = input(
-            f"The file({target_path}) already exists. Is it covered? (y/N): \n"
-        ).lower()
+        logging.info(f"The file({target_path}) already exists. Is it covered? (y/N):")
+        overwrite = input().lower()
         if overwrite != "y":
             logging.warning("Exit!")
             return