forked from enviPath/enviPy
Model Building UI Flag (#39)
Fixes #8 Flag only disables UI Elements Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#39
This commit is contained in:
@ -260,6 +260,8 @@ CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'
|
||||
CELERY_ACCEPT_CONTENT = ['json']
|
||||
CELERY_TASK_SERIALIZER = 'json'
|
||||
|
||||
MODEL_BUILDING_ENABLED = os.environ.get('MODEL_BUILDING_ENABLED', 'False') == 'True'
|
||||
|
||||
DEFAULT_RF_MODEL_PARAMS = {
|
||||
'base_clf': RandomForestClassifier(
|
||||
n_estimators=100,
|
||||
@ -312,3 +314,12 @@ if SENTRY_ENABLED:
|
||||
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
|
||||
send_default_pii=True,
|
||||
)
|
||||
|
||||
# compile into digestible flags
|
||||
FLAGS = {
|
||||
'MODEL_BUILDING': MODEL_BUILDING_ENABLED,
|
||||
'CELERY': FLAG_CELERY_PRESENT,
|
||||
'PLUGINS': PLUGINS_ENABLED,
|
||||
'SENTRY': SENTRY_ENABLED,
|
||||
'ENVIFORMER': ENVIFORMER_PRESENT,
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ def get_base_context(request, for_user=None) -> Dict[str, Any]:
|
||||
'writeable_packages': PackageManager.get_all_writeable_packages(current_user),
|
||||
'available_groups': GroupManager.get_groups(current_user),
|
||||
'available_settings': SettingManager.get_all_settings(current_user),
|
||||
'enabled_features': [],
|
||||
'enabled_features': s.FLAGS,
|
||||
'debug': s.DEBUG,
|
||||
},
|
||||
}
|
||||
@ -572,11 +572,14 @@ def package_models(request, package_uuid):
|
||||
context['model_types'] = {
|
||||
'ML Relative Reasoning': 'ml-relative-reasoning',
|
||||
'Rule Based Relative Reasoning': 'rule-based-relative-reasoning',
|
||||
'EnviFormer': 'enviformer',
|
||||
}
|
||||
|
||||
for k, v in s.CLASSIFIER_PLUGINS.items():
|
||||
context['model_types'][v.display()] = k
|
||||
if s.FLAGS.get('ENVIFORMER', False):
|
||||
context['model_types']['EnviFormer'] = 'enviformer'
|
||||
|
||||
if s.FLAGS.get('PLUGINS', False):
|
||||
for k, v in s.CLASSIFIER_PLUGINS.items():
|
||||
context['model_types'][v.display()] = k
|
||||
|
||||
return render(request, 'collections/objects_list.html', context)
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% if meta.can_edit %}
|
||||
{% if meta.can_edit and meta.enabled_features.MODEL_BUILDING %}
|
||||
<li>
|
||||
<a role="button" data-toggle="modal" data-target="#new_model_modal">
|
||||
<span class="glyphicon glyphicon-plus"></span> New Model</a>
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
class="form-control">
|
||||
<option value="MACCS" selected>MACCS Fingerprinter</option>
|
||||
</select>
|
||||
{% if 'plugins' in meta.enabled_features %}
|
||||
{% if meta.enabled_features.PLUGINS %}
|
||||
<!-- Property Plugins go here -->
|
||||
<label for="ml-relative-reasoning-additional-fingerprinter">Fingerprinter</label>
|
||||
<select id="ml-relative-reasoning-additional-fingerprinter"
|
||||
@ -86,7 +86,7 @@
|
||||
</select>
|
||||
{% endif %}
|
||||
<label for="ml-relative-reasoning-threshold">Threshold</label>
|
||||
<input type="number" min="0" , max="1" step="0.05" value="0.5"
|
||||
<input type="number" min="0" max="1" step="0.05" value="0.5"
|
||||
id="ml-relative-reasoning-threshold"
|
||||
name="ml-relative-reasoning-threshold" class="form-control">
|
||||
|
||||
@ -122,7 +122,7 @@
|
||||
name="enviformer-threshold" class="form-control">
|
||||
</div>
|
||||
|
||||
{% if 'applicability_domain' in enabled_features %}
|
||||
{% if meta.enabled_features.APPLICABILITY_DOMAIN %}
|
||||
<div class="modal-body hide" data-step="3" data-title="Advanced Options II">
|
||||
<div class="jumbotron">Selection of parameter values for the Applicability Domain process.
|
||||
Number of Neighbours refers to a requirement on the minimum number of compounds from the
|
||||
|
||||
Reference in New Issue
Block a user