form variable not set when returning from get in CreateView

class CreateProfile(LoginRequiredMixin, generic.CreateView):
    model = UserProfile
    form_class = UserProfileForm
    template_name = 'create_profile.html'
    success_url = reverse_lazy('dashboard')

    def get(self, request, *args, **kwargs):        
        if UserProfile.objects.filter(user=request.user).count() > 5:
            return render(request, 'restrict_profile.html')
        
        return render(request, self.template_name, {})

if count() is less than 5, then return render(request, self.template_name, {}) renders the template ‘create_profile.html’ but the form details like {{ form.title.label }} and {% render_field form.title class="form-control" %} are all empty. It’s like as if the form variable is not set in the template.

Solved.
return render(request, self.template_name, {'form': UserProfileForm()})