Spaces:
Configuration error
Configuration error
Download lstm_model.py from vikranth1111/cap: direct link, hf CLI and curl.
- Browser
- Download file 625 Bytes
-
https://huggingface.co/spaces/vikranth1111/cap/resolve/main/lstm_model.py
- Command line
-
hf download hf://spaces/vikranth1111/cap/lstm_model.py
-
curl -L -o lstm_model.py https://huggingface.co/spaces/vikranth1111/cap/resolve/main/lstm_model.py
625 Bytes
| from tensorflow.keras.layers import Dense, Dropout, LSTM, Bidirectional | |
| from tensorflow.keras import Sequential | |
| def my_LSTM(embedding_layer): | |
| print('Creating model...') | |
| model = Sequential() | |
| model.add(embedding_layer) | |
| model.add(Dropout(0.2)) | |
| model.add(Bidirectional(LSTM(units=64, dropout=0.1, recurrent_dropout=0.1))) | |
| model.add(Dense(50, activation="relu")) | |
| model.add(Dropout(0.1)) | |
| model.add(Dense(1, activation = "sigmoid")) | |
| print('Compiling...') | |
| model.compile(loss='binary_crossentropy', | |
| optimizer='adam', | |
| metrics=["accuracy"]) | |
| return model |