未验证 提交 33cac039 编写于 作者: H huzhiqiang 提交者: GitHub

[Python Demo] Modify python demo to improve its usability

上级 45bac312
...@@ -20,9 +20,6 @@ from __future__ import division ...@@ -20,9 +20,6 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import sys
sys.path.append('../../python/lib')
from paddlelite.lite import * from paddlelite.lite import *
# Command arguments # Command arguments
...@@ -42,8 +39,8 @@ def RunModel(args): ...@@ -42,8 +39,8 @@ def RunModel(args):
config.set_param_file(args.param_file) config.set_param_file(args.param_file)
else: else:
config.set_model_dir(args.model_dir) config.set_model_dir(args.model_dir)
# For x86, you can set places = [Place(TargetType.X86, PrecisionType.FP32)] # For arm platform (armlinux), you can set places = [Place(TargetType.ARM, PrecisionType.FP32)]
places = [Place(TargetType.ARM, PrecisionType.FP32)] places = [Place(TargetType.X86, PrecisionType.FP32)]
config.set_valid_places(places) config.set_valid_places(places)
# 2. Create paddle predictor # 2. Create paddle predictor
......
...@@ -20,8 +20,6 @@ from __future__ import division ...@@ -20,8 +20,6 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import sys
sys.path.append('../../python/lib')
from paddlelite.lite import * from paddlelite.lite import *
...@@ -33,7 +31,7 @@ parser.add_argument( ...@@ -33,7 +31,7 @@ parser.add_argument(
def RunModel(args): def RunModel(args):
# 1. Set config information # 1. Set config information
config = MobileConfig() config = MobileConfig()
config.set_model_dir(args.model_dir) config.set_model_from_file(args.model_dir)
# 2. Create paddle predictor # 2. Create paddle predictor
predictor = create_paddle_predictor(config) predictor = create_paddle_predictor(config)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册