import dataiku
from dataiku.customwebapp import get_webapp_config
from lal.api import define_endpoints
from lal.app_configuration import prepare_datasets
from lal.classifiers.image_object_classifier import ImageObjectClassifier
from lal.handlers.dataiku_lal_handler import DataikuLALHandler

config = get_webapp_config()

labels_schema = [{"name": "path", "type": "string"}]
prepare_datasets(config, labels_schema)

unlabeled_mf = dataiku.Folder(config["unlabeled"])

queries_df = dataiku.Dataset(
    config["queries_ds"]).get_dataframe() if "queries_ds" in config else None

define_endpoints(
    app,
    DataikuLALHandler(ImageObjectClassifier(unlabeled_mf, queries_df, config),
                      config))
        required=(dku_config.language == "language_column")
    )
    dku_config.add_param(
        name='text_direction',
        value=config.get('text_direction'),
        checks=[{
            'type': 'in',
            'op': ['rtl', 'ltr']
        }],
        required=(dku_config.language == "none")
    )
    dku_config.add_param(
        name='tokenization_engine',
        value=config.get('tokenization_engine'),
        checks=[{
            'type': 'in',
            'op': ['white_space', 'char']
        }],
        required=(dku_config.language == "none")
    )
    return dku_config


config = get_webapp_config()
dku_config = create_dku_config(config)
prepare_datasets(dku_config)
initial_df = dataiku.Dataset(config["unlabeled"]).get_dataframe()
queries_df = None


define_endpoints(app, DataikuLALHandler(TextClassifier(initial_df, queries_df, dku_config), dku_config))
示例#3
0
import dataiku
from dataiku.customwebapp import get_webapp_config

from lal.api import define_endpoints
from lal.app_configuration import prepare_datasets
from lal.classifiers.tabular_classifier import TabularClassifier
from lal.handlers.dataiku_lal_handler import DataikuLALHandler

config = get_webapp_config()
prepare_datasets(config)
initial_df = dataiku.Dataset(config["unlabeled"]).get_dataframe()
queries_df = dataiku.Dataset(
    config["queries_ds"]).get_dataframe() if "queries_ds" in config else None

define_endpoints(
    app,
    DataikuLALHandler(TabularClassifier(initial_df, queries_df, config),
                      config))
示例#4
0
import dataiku
from dataiku.customwebapp import get_webapp_config

from lal.api import define_endpoints
from lal.app_configuration import prepare_datasets
from lal.classifiers.image_classifier import ImageClassifier
from lal.handlers.dataiku_lal_handler import DataikuLALHandler

config = get_webapp_config()

labels_schema = [{"name": "path", "type": "string"}]
prepare_datasets(labels_schema)

unlabeled_mf = dataiku.Folder(config["unlabeled"])

queries_df = dataiku.Dataset(
    config["queries_ds"]).get_dataframe() if "queries_ds" in config else None

define_endpoints(
    app,
    DataikuLALHandler(ImageClassifier(unlabeled_mf, queries_df, config),
                      config))
import dataiku
from dataiku.customwebapp import get_webapp_config

from lal.api import define_endpoints
from lal.app_configuration import prepare_datasets
from lal.classifiers.tabular_classifier import TabularClassifier
from lal.handlers.dataiku_lal_handler import DataikuLALHandler

config = get_webapp_config()
prepare_datasets()
initial_df = dataiku.Dataset(config["unlabeled"]).get_dataframe()
queries_df = dataiku.Dataset(config["queries_ds"]).get_dataframe() if "queries_ds" in config else None

define_endpoints(app, DataikuLALHandler(TabularClassifier(initial_df, queries_df, config), config))