(ctx, **kwargs)
\b
    - DESCRIPTION:
        Import the model from a file or storage engine.

    \b
    - USAGE:
        flow model import -c fate_flow/examples/import_model.json
        flow model import -c fate_flow/examples/restore_model.json --from-database
\b
    - DESCRIPTION:
        Import the model from a file or storage engine.
\ b - DESCRIPTION : Import the model from a file or storage engine .
def import_model(ctx, **kwargs):
    """
    \b
    - DESCRIPTION:
        Import the model from a file or storage engine.

    \b
    - USAGE:
        flow model import -c fate_flow/examples/import_model.json
        flow model import -c fate_flow/examples/restore_model.json --from-database
    """
    config_data, dsl_data = preprocess(**kwargs)
    if not config_data.pop('from_database'):
        file_path = config_data.get("file", None)
        if file_path:
            if not os.path.isabs(file_path):
                file_path = os.path.join(get_project_base_directory(), file_path)
            if os.path.exists(file_path):
                files = {'file': open(file_path, 'rb')}
                access_server('post', ctx, 'model/import', data=config_data, files=files)
            else:
                prettify({'retcode': 100,
                          'retmsg': 'Import model failed. The file is obtained from the fate flow client machine, '
                                    'but it does not exist, please check the path: {}'.format(file_path)})
        else:
            prettify({
                'retcode': 100,
                'retmsg': "Import model failed. Please specify the valid model file path and try again."
            })
    else:
        access_server('post', ctx, 'model/restore', config_data)
def import_model ( ctx , * * kwargs ) : config_data , dsl_data = preprocess ( * * kwargs ) if not config_data . pop ( 'from_database' ) : file_path = config_data . get ( "file" , None ) if file_path : if not os . path . isabs ( file_path ) : file_path = os . path . join ( get_project_base_directory ( ) , file_path ) if os . path . exists ( file_path ) : files = { 'file' : open ( file_path , 'rb' ) } access_server ( 'post' , ctx , 'model/import' , data = config_data , files = files ) else : prettify ( { 'retcode' : 100 , 'retmsg' : 'Import model failed. The file is obtained from the fate flow client machine, ' 'but it does not exist, please check the path: {}' . format ( file_path ) } ) else : prettify ( { 'retcode' : 100 , 'retmsg' : "Import model failed. Please specify the valid model file path and try again." } ) else : access_server ( 'post' , ctx , 'model/restore' , config_data )