diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9472bcfa3e07..eedf6d939748 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -16,7 +16,7 @@ repos:
       - id: auto-walrus
 
   - repo: https://github.com/astral-sh/ruff-pre-commit
-    rev: v0.3.7
+    rev: v0.4.1
     hooks:
       - id: ruff
       - id: ruff-format
@@ -29,7 +29,7 @@ repos:
           - tomli
 
   - repo: https://github.com/tox-dev/pyproject-fmt
-    rev: "1.7.0"
+    rev: "1.8.0"
     hooks:
       - id: pyproject-fmt
 
diff --git a/computer_vision/cnn_classification.py b/computer_vision/cnn_classification.py
index b813b71033f3..115333eba0d1 100644
--- a/computer_vision/cnn_classification.py
+++ b/computer_vision/cnn_classification.py
@@ -25,7 +25,7 @@
 
 # Importing the Keras libraries and packages
 import tensorflow as tf
-from tensorflow.keras import layers, models
+from keras import layers, models
 
 if __name__ == "__main__":
     # Initialising the CNN
diff --git a/machine_learning/lstm/lstm_prediction.py b/machine_learning/lstm/lstm_prediction.py
index f0fd12c9de7f..81ac5f01d3d6 100644
--- a/machine_learning/lstm/lstm_prediction.py
+++ b/machine_learning/lstm/lstm_prediction.py
@@ -7,9 +7,9 @@
 
 import numpy as np
 import pandas as pd
+from keras.layers import LSTM, Dense
+from keras.models import Sequential
 from sklearn.preprocessing import MinMaxScaler
-from tensorflow.keras.layers import LSTM, Dense
-from tensorflow.keras.models import Sequential
 
 if __name__ == "__main__":
     """