@blueprint.route('/index.json', methods=['GET'])
@blueprint.route('/', methods=['GET'])
def home(tab=2):
 running_datasets = get_job_list(dataset.DatasetJob, True)
 completed_datasets = get_job_list(dataset.DatasetJob, False)
 running_models = get_job_list(model.ModelJob, True)
 completed_models = get_job_list(model.ModelJob, False)
 if request_wants_json():
  data = {'version': digits.__version__, 'jobs_dir': config_value('jobs_dir'), 'datasets': [j.json_dict() for j in (running_datasets + completed_datasets)], 'models': [j.json_dict() for j in (running_models + completed_models)]}
  if config_value('server_name'):
   data['server_name'] = config_value('server_name')
  return flask.jsonify(data)
 else:
  new_dataset_options = {'Images': {'image-classification': {'title': 'Classification', 'url': flask.url_for('digits.dataset.images.classification.views.new')}, 'image-other': {'title': 'Other', 'url': flask.url_for('digits.dataset.images.generic.views.new')}}}
  new_model_options = {'Images': {'image-classification': {'title': 'Classification', 'url': flask.url_for('digits.model.images.classification.views.new')}, 'image-other': {'title': 'Other', 'url': flask.url_for('digits.model.images.generic.views.new')}}}
  load_model_options = {'Images': {'pretrained-model': {'title': 'Upload Pretrained Model', 'id': 'uploadPretrainedModel', 'url': flask.url_for('digits.pretrained_model.views.new')}, 'access-model-store': {'title': 'Retrieve from Model Store', 'id': 'retrieveModelStore', 'url': flask.url_for('digits.store.views.store')}}}
  data_extensions = extensions.data.get_extensions()
  for extension in data_extensions:
   ext_category = extension.get_category()
   ext_title = extension.get_title()
   ext_id = extension.get_id()
   if (ext_category not in new_dataset_options):
    new_dataset_options[ext_category] = {}
   new_dataset_options[ext_category][ext_id] = {'title': ext_title, 'url': flask.url_for('digits.dataset.generic.views.new', extension_id=ext_id)}
   if (ext_category not in new_model_options):
    new_model_options[ext_category] = {}
   new_model_options[ext_category][ext_id] = {'title': ext_title, 'url': flask.url_for('digits.model.images.generic.views.new', extension_id=ext_id)}
  return flask.render_template('home.html', tab=tab, new_dataset_options=new_dataset_options, running_datasets=running_datasets, completed_datasets=completed_datasets, new_model_options=new_model_options, running_models=running_models, completed_models=completed_models, load_model_options=load_model_options, total_gpu_count=len(scheduler.resources['gpus']), remaining_gpu_count=sum((r.remaining() for r in scheduler.resources['gpus'])))

@ blueprint . route ( '/index.json' , methods = [ 'GET' ] ) @ blueprint . route ( '/' , methods = [ 'GET' ] ) def home ( tab = 2 ) : running_datasets = get_job_list ( dataset . DatasetJob , True ) completed_datasets = get_job_list ( dataset . DatasetJob , False ) running_models = get_job_list ( model . ModelJob , True ) completed_models = get_job_list ( model . ModelJob , False ) if request_wants_json ( ) : data = { 'version' : digits . __version__ , 'jobs_dir' : config_value ( 'jobs_dir' ) , 'datasets' : [ j . json_dict ( ) for j in ( running_datasets + completed_datasets ) ] , 'models' : [ j . json_dict ( ) for j in ( running_models + completed_models ) ] } if config_value ( 'server_name' ) : data [ 'server_name' ] = config_value ( 'server_name' ) return flask . jsonify ( data ) else : new_dataset_options = { 'Images' : { 'image-classification' : { 'title' : 'Classification' , 'url' : flask . url_for ( 'digits.dataset.images.classification.views.new' ) } , 'image-other' : { 'title' : 'Other' , 'url' : flask . url_for ( 'digits.dataset.images.generic.views.new' ) } } } new_model_options = { 'Images' : { 'image-classification' : { 'title' : 'Classification' , 'url' : flask . url_for ( 'digits.model.images.classification.views.new' ) } , 'image-other' : { 'title' : 'Other' , 'url' : flask . url_for ( 'digits.model.images.generic.views.new' ) } } } load_model_options = { 'Images' : { 'pretrained-model' : { 'title' : 'Upload Pretrained Model' , 'id' : 'uploadPretrainedModel' , 'url' : flask . url_for ( 'digits.pretrained_model.views.new' ) } , 'access-model-store' : { 'title' : 'Retrieve from Model Store' , 'id' : 'retrieveModelStore' , 'url' : flask . url_for ( 'digits.store.views.store' ) } } } data_extensions = extensions . data . get_extensions ( ) for extension in data_extensions : ext_category = extension . get_category ( ) ext_title = extension . get_title ( ) ext_id = extension . get_id ( ) if ( ext_category not in new_dataset_options ) : new_dataset_options [ ext_category ] = { } new_dataset_options [ ext_category ] [ ext_id ] = { 'title' : ext_title , 'url' : flask . url_for ( 'digits.dataset.generic.views.new' , extension_id = ext_id ) } if ( ext_category not in new_model_options ) : new_model_options [ ext_category ] = { } new_model_options [ ext_category ] [ ext_id ] = { 'title' : ext_title , 'url' : flask . url_for ( 'digits.model.images.generic.views.new' , extension_id = ext_id ) } return flask . render_template ( 'home.html' , tab = tab , new_dataset_options = new_dataset_options , running_datasets = running_datasets , completed_datasets = completed_datasets , new_model_options = new_model_options , running_models = running_models , completed_models = completed_models , load_model_options = load_model_options , total_gpu_count = len ( scheduler . resources [ 'gpus' ] ) , remaining_gpu_count = sum ( ( r . remaining ( ) for r in scheduler . resources [ 'gpus' ] ) ) )
home page .