# alueError: Input 0 of layer sequential is incompatible with the layer: expected axis -1 of input shape to have value 4126 but received input with shape \[None, 9\]\\n"

**URL:** <https://forum.djangoproject.com/t/alueerror-input-0-of-layer-sequential-is-incompatible-with-the-layer-expected-axis-1-of-input-shape-to-have-value-4126-but-received-input-with-shape-none-9-n/7383>\
**Category:** Using Django\
**Created:** [April 5, 2021, 5:32pm UTC](https://forum.djangoproject.com/t/alueerror-input-0-of-layer-sequential-is-incompatible-with-the-layer-expected-axis-1-of-input-shape-to-have-value-4126-but-received-input-with-shape-none-9-n/7383 "2021-04-05T17:32:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Believe](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/believe/32/4122_2.png) [@Believe](https://forum.djangoproject.com/u/Believe)\
**Post date:** [April 5, 2021, 5:32pm UTC](https://forum.djangoproject.com/t/alueerror-input-0-of-layer-sequential-is-incompatible-with-the-layer-expected-axis-1-of-input-shape-to-have-value-4126-but-received-input-with-shape-none-9-n/7383/1 "2021-04-05T17:32:16Z")

</div>

Hi everyone, this is my first post here - hopefully it is okay to ask for advice as I am still new to Django.

I have this error below when doing a POST for a ML model, I need a bit of help to point me in the right direction, please

* * *

raise ValueError(\n\n ValueError: Input 0 of layer sequential is incompatible with the layer: expected axis -1 of input shape to have value 4126 but received input with shape [None, 9]\n"

* * *

Below is my view.py file  
def approvereject(request):  
try:  
mdl = keras.models.load\_model(‘C:/Users/belie/Google Drive/Djangodeployment/DjangoAPI/main\_model/model’)  
mdl.load\_weights(“C:/Users/belie/Google Drive/Djangodeployment/DjangoAPI/main\_model/model.h5”)  
mydata = request.data  
unit = np.array(list(mydata.values()))  
unit = unit.reshape(-1,0)  
scalers = pd.read\_pickle(“C:/Users/belie/Google Drive/Djangodeployment/DjangoAPI/main\_model/scaler.pkl”)  
scalers = StandardScaler()  
X = scalers.fit\_transform(unit)  
#X = scalers.transform(unit)  
y\_pred = mdl.predict(X)  
#y\_pred=(y\_pred\>0.58)  
newdf = pd.DataFrame(y\_pred, columns= [‘Network Classsification’])  
newdf = newdf.replace({0:‘Benign’, 1:‘Malicious’})  
return JsonResponse(‘Your Status is {}’.format(newdf), safe=False)  
except ValueError as e:  
return Response(e.args[0], status.HTTP\_400\_BAD\_REQUEST)

Thank you!

---

<div class="post-metadata">

**Author:** ![marcorichetta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/marcorichetta/32/26473_2.png) [@marcorichetta](https://forum.djangoproject.com/u/marcorichetta)\
**Post date:** [April 5, 2021, 8:44pm UTC](https://forum.djangoproject.com/t/alueerror-input-0-of-layer-sequential-is-incompatible-with-the-layer-expected-axis-1-of-input-shape-to-have-value-4126-but-received-input-with-shape-none-9-n/7383/2 "2021-04-05T20:44:26Z")

</div>

Hi @Believe!  
It’s fine to ask for advice even if you’re an experienced developer!

Not really into ML so I can’t help with your specific error but first result on [DuckDuckGo](https://duckduckgo.com/?t=ffab&q=Input+0+of+layer+sequential+is+incompatible+with+the+layer%3A+expected+axis+-1+of+input+shape+to+have+value+4126+but+received+input+with+shape&ia=web)  
shows a person with the exact same error.

PD:  
When posting code here, please encapsulate it between 3 backticks, like this:

![imagen](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/9/9d4836959c7515d50178d0c490de6d82618d2e5b.png)

Result:

```auto
class CustomView(CreateView):
    parameter = "value"

```

It will be nicer to read for all of us 👍
