Adityaganesh commited on
Commit
d76686a
·
verified ·
1 Parent(s): a3f76e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -8,7 +8,6 @@ import nltk
8
  from nltk.tokenize import word_tokenize
9
  from nltk.corpus import stopwords
10
  from nltk.stem import WordNetLemmatizer
11
-
12
  # Download necessary resources
13
  nltk.download('punkt_tab')
14
  nltk.download('stopwords')
@@ -17,8 +16,8 @@ nltk.download('wordnet')
17
  import tensorflow
18
  import keras
19
  from keras.utils import pad_sequences
 
20
  import pickle
21
- import base64
22
 
23
  # Streamlit UI
24
  st.set_page_config(page_title="News Category Classifier", page_icon="📰", layout="centered")
@@ -40,7 +39,7 @@ def set_background(image_path):
40
  st.markdown(bg_image_style, unsafe_allow_html=True)
41
 
42
  # Update the image path
43
- set_background("page/Images/bkg4.jpg") # Ensure the image is in the correct folder
44
 
45
  # Initialize stopwords and lemmatizer
46
  stop_words = set(stopwords.words('english')).union({"pm"})
@@ -159,4 +158,4 @@ if st.button("Analyze 🏷️"):
159
  category = predict_category(user_input)
160
  st.markdown(f"<div class='result-box'><span class='result-text'>🗂️ Predicted Category: <strong>{category}</strong></span></div>", unsafe_allow_html=True)
161
  else:
162
- st.warning("⚠️ Please enter some text to analyze.")
 
8
  from nltk.tokenize import word_tokenize
9
  from nltk.corpus import stopwords
10
  from nltk.stem import WordNetLemmatizer
 
11
  # Download necessary resources
12
  nltk.download('punkt_tab')
13
  nltk.download('stopwords')
 
16
  import tensorflow
17
  import keras
18
  from keras.utils import pad_sequences
19
+
20
  import pickle
 
21
 
22
  # Streamlit UI
23
  st.set_page_config(page_title="News Category Classifier", page_icon="📰", layout="centered")
 
39
  st.markdown(bg_image_style, unsafe_allow_html=True)
40
 
41
  # Update the image path
42
+ set_background("page/News image 2.png") # Ensure the image is in the correct folder
43
 
44
  # Initialize stopwords and lemmatizer
45
  stop_words = set(stopwords.words('english')).union({"pm"})
 
158
  category = predict_category(user_input)
159
  st.markdown(f"<div class='result-box'><span class='result-text'>🗂️ Predicted Category: <strong>{category}</strong></span></div>", unsafe_allow_html=True)
160
  else:
161
+ st.warning("⚠️ Please enter some text to analyze.")