forked from enviPath/enviPy
...
This commit is contained in:
@ -784,6 +784,10 @@ def models(request):
|
||||
{"Home": s.SERVER_URL},
|
||||
{"Model": s.SERVER_URL + "/model"},
|
||||
]
|
||||
context["entity_type"] = "model"
|
||||
context["api_endpoint"] = f"{s.SERVER_PATH}/api/v1/models/"
|
||||
context["per_page"] = s.API_PAGINATION_DEFAULT_PAGE_SIZE
|
||||
context["list_title"] = "models"
|
||||
|
||||
# Keep model_types for potential modal/action use
|
||||
context["model_types"] = {
|
||||
@ -797,12 +801,14 @@ def models(request):
|
||||
"requires_rule_packages": True,
|
||||
"requires_data_packages": True,
|
||||
},
|
||||
"EnviFormer": {
|
||||
}
|
||||
|
||||
if s.ENVIFORMER_PRESENT:
|
||||
context["model_types"]["EnviFormer"] = {
|
||||
"type": "enviformer",
|
||||
"requires_rule_packages": False,
|
||||
"requires_data_packages": True,
|
||||
},
|
||||
}
|
||||
|
||||
if s.FLAGS.get("PLUGINS", False):
|
||||
for k, v in s.CLASSIFIER_PLUGINS.items():
|
||||
@ -810,6 +816,9 @@ def models(request):
|
||||
"type": k,
|
||||
"requires_rule_packages": v.requires_rule_packages(),
|
||||
"requires_data_packages": v.requires_data_packages(),
|
||||
"additional_parameters": v.Config.__name__.lower()
|
||||
if v.Config.__name__ != ""
|
||||
else None,
|
||||
}
|
||||
for k, v in s.PROPERTY_PLUGINS.items():
|
||||
context["model_types"][v.display()] = {
|
||||
@ -818,12 +827,6 @@ def models(request):
|
||||
"requires_data_packages": v.requires_data_packages(),
|
||||
}
|
||||
|
||||
# Context for paginated template
|
||||
context["entity_type"] = "model"
|
||||
context["api_endpoint"] = f"{s.SERVER_PATH}/api/v1/models/"
|
||||
context["per_page"] = s.API_PAGINATION_DEFAULT_PAGE_SIZE
|
||||
context["list_title"] = "models"
|
||||
|
||||
return render(request, "collections/models_paginated.html", context)
|
||||
|
||||
elif request.method == "POST":
|
||||
@ -3001,9 +3004,15 @@ def settings(request):
|
||||
new_default = request.POST.get("prediction-setting-new-default", "off") == "on"
|
||||
|
||||
# min 2, max s.DEFAULT_MAX_NUMBER_OF_NODES
|
||||
temp_max_nodes = request.POST.get("prediction-setting-max-nodes")
|
||||
if temp_max_nodes is None or temp_max_nodes == "" or int(temp_max_nodes) == -1:
|
||||
temp_max_nodes = s.DEFAULT_MAX_NUMBER_OF_NODES
|
||||
else:
|
||||
temp_max_nodes = int(request.POST.get("prediction-setting-max-nodes", 1))
|
||||
|
||||
max_nodes = min(
|
||||
max(
|
||||
int(request.POST.get("prediction-setting-max-nodes", 1)),
|
||||
temp_max_nodes,
|
||||
2,
|
||||
),
|
||||
s.DEFAULT_MAX_NUMBER_OF_NODES,
|
||||
@ -3024,6 +3033,7 @@ def settings(request):
|
||||
|
||||
model_uuid = model_url.split("/")[-1]
|
||||
params["model"] = EPModel.objects.get(uuid=model_uuid)
|
||||
# TODO Check if removed if request contains "" or not at all
|
||||
params["model_threshold"] = request.POST.get(
|
||||
"model-based-prediction-setting-threshold", s.DEFAULT_MODEL_THRESHOLD
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user