text_plain_output_1.png
from tensorflow.keras.layers import Dense

from tensorflow.keras.models import Sequential

from tensorflow.keras.utils import to_categorical

import numpy as np

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import pickle

df = pd.read_csv('/kaggle/input/az-handwritten-alphabets-in-csv-format/A_Z Handwritten Data.csv')

df.shape

X = df.drop(['0'], axis=1)

y = df['0']

X.iloc[0].shape

imag = X.iloc[9]
import numpy as np
imagenum = np.array(imag)
finalimage = imagenum.reshape(28, 28)

final_X = X / 255

final_y = to_categorical(y, num_classes=26)

final_y.shape

model = Sequential()
model.add(Dense(64, activation='relu', input_shape=(784,)))
model.add(Dense(32, activation='relu'))
model.add(Dense(32, activation='relu'))
model.add(Dense(26, activation='softmax'))

model.summary()

model.compile(loss='categorical_crossentropy', metrics=['accuracy'])

model.fit(final_X, final_y, epochs=10, batch_size=32)

import pickle
pickle.dump(model, open('finalalpha.pkl', 'wb'))