def test_helloworld_py_chatbot(tmpdir): from jina.helloworld.chatbot import hello_world hello_world(set_hw_chatbot_parser().parse_args([ '--workdir', str(tmpdir), '--unblock-query-flow', '--port-expose', str(random_port()) ]))
def helloworld_args(tmpdir): return set_hw_chatbot_parser().parse_args([ '--workdir', str(tmpdir), '--port-expose', '8080', '--unblock-query-flow', '--parallel', '1', ])
def helloworld_args(tmpdir): return set_hw_chatbot_parser().parse_args([ '--workdir', str(tmpdir), '--port', '8080', '--unblock-query-flow', '--replicas', '1', ])
download_proxy=None, task_name='download fashion-mnist'): """ Download data. :param targets: target path for data. :param download_proxy: download proxy (e.g. 'http', 'https') :param task_name: name of the task """ opener = urllib.request.build_opener() opener.addheaders = [('User-agent', 'Mozilla/5.0')] if download_proxy: proxy = urllib.request.ProxyHandler({ 'http': download_proxy, 'https': download_proxy }) opener.add_handler(proxy) urllib.request.install_opener(opener) with ProgressBar(task_name=task_name, batch_unit='') as t: for k, v in targets.items(): if not os.path.exists(v['filename']): urllib.request.urlretrieve( v['url'], v['filename'], reporthook=lambda *x: t.update_tick(0.01)) if __name__ == '__main__': args = set_hw_chatbot_parser().parse_args() hello_world(args)
def chatbot_args(tmpdir): return set_hw_chatbot_parser().parse_args( ['--workdir', str(tmpdir), '--port-expose', '8080'])