Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ 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('
|
| 13 |
nltk.download('stopwords')
|
| 14 |
nltk.download('wordnet')
|
| 15 |
|
|
@@ -30,7 +30,7 @@ def set_background(image_path):
|
|
| 30 |
<style>
|
| 31 |
.stApp {{
|
| 32 |
background-image: url("data:image/png;base64,{encoded_img}");
|
| 33 |
-
background-size:
|
| 34 |
background-repeat: no-repeat;
|
| 35 |
background-attachment: fixed;
|
| 36 |
background-position: center;
|
|
@@ -40,7 +40,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("
|
| 44 |
|
| 45 |
# Initialize stopwords and lemmatizer
|
| 46 |
stop_words = set(stopwords.words('english')).union({"pm"})
|
|
@@ -154,7 +154,7 @@ st.markdown("<div class='subtitle'>Enter a news headline or article snippet to a
|
|
| 154 |
|
| 155 |
user_input = st.text_area("Enter text here:", height=150, placeholder="Type your news text here...")
|
| 156 |
|
| 157 |
-
if st.button("Analyze
|
| 158 |
if user_input.strip():
|
| 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)
|
|
|
|
| 9 |
from nltk.corpus import stopwords
|
| 10 |
from nltk.stem import WordNetLemmatizer
|
| 11 |
# Download necessary resources
|
| 12 |
+
nltk.download('punkt')
|
| 13 |
nltk.download('stopwords')
|
| 14 |
nltk.download('wordnet')
|
| 15 |
|
|
|
|
| 30 |
<style>
|
| 31 |
.stApp {{
|
| 32 |
background-image: url("data:image/png;base64,{encoded_img}");
|
| 33 |
+
background-size: 100% 100%;
|
| 34 |
background-repeat: no-repeat;
|
| 35 |
background-attachment: fixed;
|
| 36 |
background-position: center;
|
|
|
|
| 40 |
st.markdown(bg_image_style, unsafe_allow_html=True)
|
| 41 |
|
| 42 |
# Update the image path
|
| 43 |
+
set_background("page/News image 2.png") # Ensure the image is in the correct folder
|
| 44 |
|
| 45 |
# Initialize stopwords and lemmatizer
|
| 46 |
stop_words = set(stopwords.words('english')).union({"pm"})
|
|
|
|
| 154 |
|
| 155 |
user_input = st.text_area("Enter text here:", height=150, placeholder="Type your news text here...")
|
| 156 |
|
| 157 |
+
if st.button("Analyze 🍿"):
|
| 158 |
if user_input.strip():
|
| 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)
|