diff --git a/ml_models/resnet_model4_jjemslr.h5 b/ml_models/resnet_model4_jjemslr.h5 new file mode 100644 index 0000000000000000000000000000000000000000..9249b0bbe74ef06fa4cc694c0a8fad9883d1bcf3 Binary files /dev/null and b/ml_models/resnet_model4_jjemslr.h5 differ diff --git a/prediction_service/__pycache__/views.cpython-310.pyc b/prediction_service/__pycache__/views.cpython-310.pyc index a73a1ef5f5ea611e8701184b4018def739e79694..a59d4a33650aca415369ff44c92e66eea6b3159d 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.html b/prediction_service/templates/prediction_service/home.html index ec9f56c510587e7995cde19b2810cd852fc567d6..a39871b482afbe73986565384f5f9d253782b231 100644 --- a/prediction_service/templates/prediction_service/home.html +++ b/prediction_service/templates/prediction_service/home.html @@ -22,18 +22,6 @@ </div> - </div> - - <!-- Square plus button --> - {% if request.user.is_superuser or request.user.userprofile.role == 'ai_engineer' %} - <div style="position: fixed; bottom: 20px; right: 20px;"> - <a href="{% url 'MLAAS-create_post' %}"> - <button style="width: 50px; height: 50px; border-radius: 50%; background-color: #007bff; color: white; font-size: 24px; border: none;">+</button> - </a> - </div> - {% endif %} - - - + </div> {% endblock content %} \ No newline at end of file diff --git a/prediction_service/views.py b/prediction_service/views.py index c7361323d24484750cb6c48b735ef657329d5269..c16ca76076a5eb9926349af84fd66cae912f42cb 100644 --- a/prediction_service/views.py +++ b/prediction_service/views.py @@ -126,7 +126,7 @@ from .models import Post @login_required def create_post(request): - if not request.user.is_superuser and request.user.userprofile.role != 'ai_engineer': + if not request.user.is_superuser and request.user.userprofile.role != 'AI Engineer': return HttpResponseForbidden("You do not have permission to access this page.") if request.method == 'POST': @@ -136,14 +136,15 @@ def create_post(request): post.author = request.user # Assign the selected MLModel instance to the post - mlmodel_id = form.cleaned_data.get('mlmodel') - post.mlmodel_id = mlmodel_id + #mlmodel_id = form.cleaned_data.get('mlmodel') + #post.mlmodel_id = mlmodel_id # Check if the user is an AI engineer or an admin if request.user.userprofile.role == 'AI Engineer' or request.user.is_superuser: post.save() messages.success(request, 'Your post has been created successfully.') - return redirect('MLAAS-home', pk=post.pk) # Redirect to the post detail page + return redirect('MLAAS-home') # Redirect to the home page + else: messages.error(request, 'You are not authorized to create posts.') return redirect('MLAAS-home') # Redirect to home or another appropriate page