diff --git a/ml_models/resnet_model5_4buzv9z.h5 b/ml_models/resnet_model5_4buzv9z.h5 new file mode 100644 index 0000000000000000000000000000000000000000..b038bafdbed728a15653a1371de95c5e5647602f Binary files /dev/null and b/ml_models/resnet_model5_4buzv9z.h5 differ diff --git a/ml_models/resnet_model5_DUrviMz.h5 b/ml_models/resnet_model5_DUrviMz.h5 new file mode 100644 index 0000000000000000000000000000000000000000..b038bafdbed728a15653a1371de95c5e5647602f Binary files /dev/null and b/ml_models/resnet_model5_DUrviMz.h5 differ diff --git a/prediction_service/__pycache__/models.cpython-310.pyc b/prediction_service/__pycache__/models.cpython-310.pyc index 5a07257692a786e311b932998ab9bc0425a70f63..46500b9a49ced2e6a2235cd94f194f11f1eaf3a8 100644 Binary files a/prediction_service/__pycache__/models.cpython-310.pyc and b/prediction_service/__pycache__/models.cpython-310.pyc differ diff --git a/prediction_service/__pycache__/views.cpython-310.pyc b/prediction_service/__pycache__/views.cpython-310.pyc index a0e79055f79c7e743d0d1c2bc3fc4a97abd5f11f..11c3ed3906063c2bd7e32b5799d4514900655e29 100644 Binary files a/prediction_service/__pycache__/views.cpython-310.pyc and b/prediction_service/__pycache__/views.cpython-310.pyc differ diff --git a/prediction_service/templates/prediction_service/home-Admin.html b/prediction_service/templates/prediction_service/home-Admin.html index b1f031660435eac3386293de69de4a8a81326245..eb2112f69f34a174819f2129c1d688ba5a329943 100644 --- a/prediction_service/templates/prediction_service/home-Admin.html +++ b/prediction_service/templates/prediction_service/home-Admin.html @@ -22,7 +22,7 @@ - <div class="card"> + <div class="card" style="margin-bottom: 20px;"> <div class="card-body"> <h5 class="card-title">Pending AI Engineer Requests:</h5> <form method="POST" action="/home/"> @@ -42,6 +42,26 @@ </div> </div> + <div class="card"> + <div class="card-body"> + <h5 class="card-title">Remove AI Engineer role?:</h5> + <form method="POST" action="/home/"> + {% csrf_token %} + {% for account in approved %} + <div class="card" style="width: 18rem; margin-right: 15px;"> + <div class="card-body"> + <h5 class="card-title">Username: {{ account.user.user }}</h5> + <h6 class="card-subtitle mb-2 text-muted">Authorised AI Engineer</h6> + <label class="checkbox-label" for="approve-checkbox-{{ account.user }}">Remove</label> + <input type="checkbox" id="{{ account.user }}" name="removed_accounts" value="{{ account.user.id }}"> + </div> + </div> + {% endfor %} + <button type="submit" class="btn btn-primary">Submit</button> + </form> + </div> + </div> + </div> diff --git a/prediction_service/views.py b/prediction_service/views.py index 9b32fbe3fa5ab96b5e1740f62cea45a79f3951e5..bba0876455356843ec9d1f053505ca0e1a3f75ac 100644 --- a/prediction_service/views.py +++ b/prediction_service/views.py @@ -40,6 +40,10 @@ def home(request): # 3. pass them into the context of the page # 3.1 - use html majix to list them out (Like how posts are) context['pending'] = pending_engineers + + approved_engineers = AIEngineer.objects.filter(is_authorized=True) + + context['approved'] = approved_engineers # 4. we need a form for them to submit with the approved selections # 4.1 - therefore we need a view for handaling the process for changing the status to approved return render(request, 'prediction_service/home-Admin.html',context) @@ -48,6 +52,7 @@ def home(request): return render(request, 'prediction_service/home.html',context) elif request.user.is_authenticated and request.method == "POST": approved_accounts = request.POST.getlist('approved_accounts') + removed_accounts = request.POST.getlist('removed_accounts') for account in approved_accounts: # Process each approved account ID @@ -59,6 +64,15 @@ def home(request): messages.success(request, f'{ai_engineer.user.user} approved as AI Engineer!') + for account in removed_accounts: + ai_engineer = AIEngineer.objects.get(user=account) + + ai_engineer.is_authorized = False + + ai_engineer.save() + + messages.success(request, f'{ai_engineer.user.user} REMOVED as AI Engineer!') + return redirect('MLAAS-home') else: return HttpResponse("<h1> you are not authenticated but are logged in? </h1>")