Mpavan45 commited on
Commit
9d28303
·
verified ·
1 Parent(s): dc6c0b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -3,7 +3,7 @@ import tensorflow as tf
3
  import numpy as np
4
 
5
  # Load the trained model
6
- model = tf.keras.models.load_model("news_classification_rnn.h5")
7
 
8
  # Load Preprocessing Function
9
  import dill
@@ -11,7 +11,7 @@ with open("preprocessing1.pkl", "rb") as f:
11
  clean_text = dill.load(f)
12
 
13
  # Load Text Vectorization Layer from SavedModel
14
- vectorizer = tf.saved_model.load("vectorizer")
15
 
16
  # Define News Categories
17
  news_categories = ["Business", "Sci/Tech", "Sports", "World"]
@@ -31,7 +31,7 @@ if st.button("Classify"):
31
  text_sequence = vectorizer([processed_text])
32
 
33
  # Convert to numpy array (model expects batch input)
34
- text_sequence = np.array(text_sequence)
35
 
36
  # Predict Category
37
  prediction = model.predict(text_sequence)
 
3
  import numpy as np
4
 
5
  # Load the trained model
6
+ model = tf.keras.models.load_model("news_classification_rnn1.h5")
7
 
8
  # Load Preprocessing Function
9
  import dill
 
11
  clean_text = dill.load(f)
12
 
13
  # Load Text Vectorization Layer from SavedModel
14
+ vectorizer = tf.saved_model.load("vector")
15
 
16
  # Define News Categories
17
  news_categories = ["Business", "Sci/Tech", "Sports", "World"]
 
31
  text_sequence = vectorizer([processed_text])
32
 
33
  # Convert to numpy array (model expects batch input)
34
+
35
 
36
  # Predict Category
37
  prediction = model.predict(text_sequence)