コード例 #1
0
ファイル: atv.py プロジェクト: inz1981/autoTv
def main():
    """
    Main function
    """
    log = logging.getLogger(__name__)
    log.info("Starting AutoTV")

    usage = "%prog -c FILE [--debug]"

    # the version of Auto TV.
    version = "0.1"

    parser = optparse.OptionParser(usage=usage, version=version)
    parser.add_option(
        "-c", "--config",
        dest="config_file",
        help="the config file(e.g. autotv.cfg)",
        metavar="FILE")

    parser.add_option(
        "--debug",
        action="store_true",
        dest="verbose",
        default=False,
        help="print more info")

    options, _ = parser.parse_args()

    # setup logging
    if options.verbose:
        # set logging to debug
        utils.setup_logging(logging.DEBUG)
    else:
        utils.setup_logging(logging.INFO)

    log.debug("Input arguments: {%s}".format(options))

    # the config file is mandatory
    if not options.config_file:
        parser.error("Missing mandatory argument: '-c/--config'")

    log.info('Starting Auto TV...')

    # read the config
    cfg = Config(options.config_file)
    # cfg_options = cfg.cfg_options

    # Start TV Parsing
    tvp = TVParser(cfg)
    if options.verbose:
        tvp.store_debug_info()
    copy_tvs = tvp.get_unstored_tv_contents()
    tvp.transfer_tv_contents(copy_tvs)

    # Start Movie Parsing
    movieparser = MovieParser(cfg)
    if options.verbose:
        movieparser.store_debug_info()

    log.info("exit!")
コード例 #2
0
ファイル: main.py プロジェクト: BinalModi/reproserver
def main():
    setup_logging('REPROSERVER-RUNNER')

    # SQL database
    global SQLSession
    engine, SQLSession = database.connect()

    # AMQP
    tasks = TaskQueues()

    # Object storage
    global object_store
    object_store = get_object_store()

    logging.info("Ready, listening for requests")
    tasks.consume_run_tasks(run_request)
コード例 #3
0
from flask import Flask
from flask_restful import Api

from common.utils import setup_logging
from resources.fruit import Fruit
from resources.fruits import Fruits
from resources.nested_fruits import NestedFruits

app = Flask(__name__)
app.secret_key = "dev"
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

api = Api(app)

api.add_resource(Fruits, "/api/v1/fruits")
api.add_resource(Fruit, "/api/v1/fruit/<int:_id>")
api.add_resource(NestedFruits, "/api/v1/fruit/nest")

if __name__ == "__main__":

    @app.before_first_request
    def create_tables():
        db.create_all()

    from db import db
    setup_logging()
    db.init_app(app)
    app.run(port=5000, host="0.0.0.0")
コード例 #4
0
    if _args.aicrowd_challenge:
        from aicrowd import utils_pytorch as pyu, aicrowd_helpers
        # Export the representation extractor
        path_to_saved = pyu.export_model(pyu.RepresentationExtractor(model.model.encoder, 'mean'),
                                         input_shape=(1, model.num_channels, model.image_size, model.image_size))
        logging.info(f'A copy of the model saved in {path_to_saved}')

        if on_aicrowd_server:
            # AICrowd will handle the evaluation
            aicrowd_helpers.register_progress(1.0)
            aicrowd_helpers.submit()
        else:
            # Run evaluation locally
            # The local_evaluation is implemented by aicrowd in the global namespace, so importing it suffices.
            #  todo: implement a modular version of local_evaluation
            # noinspection PyUnresolvedReferences
            from aicrowd import local_evaluation


if __name__ == "__main__":
    _args = get_args(sys.argv[1:])
    setup_logging(_args.verbose)
    initialize_seeds(_args.seed)

    # set the environment variables for dataset directory and name, and check if the root dataset directory exists.
    set_environment_variables(_args.dset_dir, _args.dset_name)
    assert os.path.exists(os.environ.get('DISENTANGLEMENT_LIB_DATA', '')), \
        'Root dataset directory does not exist at: \"{}\"'.format(_args.dset_dir)

    main(_args)
コード例 #5
0
import os
import sys


sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))


from common.utils import setup_logging  # noqa

setup_logging('REPROSERVER-WEB')

from web.main import main  # noqa

main()