AttributeError 'function' object has no attribute 'predict'

I got error like this AttributeError 'function' object has no attribute 'predict' while I put the 'predict' in line 19. I tried to change the attribute but it has the same problem. How to solve the error?

AttributeError at /predict/result/

'function' object has no attribute 'predict'

I put this code in views.py

def result(request):
cls = joblib.load("pnn_parkinson.sav")
gaussian_tf = lambda x: (1.0/tf.sqrt(2*np.pi))* tf.exp(-.5*x**2) 
lis = []
    
lis.append(request.GET['n1'])
lis.append(request.GET['n2'])
lis.append(request.GET['n3'])
lis.append(request.GET['n4'])
lis.append(request.GET['n5'])
lis.append(request.GET['n6'])
lis.append(request.GET['n7'])
lis.append(request.GET['n8'])
lis.append(request.GET['n9'])
lis.append(request.GET['n10'])
lis.append(request.GET['n11'])
lis.append(request.GET['n12'])
    
predict = cls.predict([[lis]])

result = ""
if predict==[1]:
    result = "Positive Parkinson"
else:
    "No Parkinson"    
return render(request, "result.html", {"result1":result, 'predict':predict, 'lis':lis})

I also put this code in predict.html

      <div class="form-inline container p-5 my-5 border text-dark" style="text-align:left">
    <h2>Prediksi</h2>
    <form action = "result" method="GET"> {% csrf_token %}
      <div class="mb-3 row form-inline">
        <label for="text" class="col-sm-2 col-form-label">MDVP:Fo(Hz)</label>
          <div class="col-md-4">
            <input type="text" class="form-control" id="text" placeholder="Enter MDVP:Fo(Hz)" name="n1" required>
          </div>

In the urls.py I put this code

path('predict/result/', views.result, name='result'),
Back to Top