Adityaganesh commited on
Commit
88b72d5
·
verified ·
1 Parent(s): 8fd0330

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -17
app.py CHANGED
@@ -51,31 +51,24 @@ def predict_category(text):
51
  category_idx = np.argmax(prediction, axis=1)[0]
52
  return label_encoder.inverse_transform([category_idx])[0]
53
 
54
- # ✅ Ensure your image is stored in the 'static' folder and referenced properly
55
- image_path = "static/News image 2.png"
56
 
57
- # Streamlit UI with Custom Blurred Background
58
- page_bg_img = f'''
59
  <style>
60
- body::before {{
61
- content: "";
62
- background: url("{image_path}") no-repeat center center fixed;
63
  background-size: cover;
64
- position: fixed;
65
- top: 0;
66
- left: 0;
67
- width: 100%;
68
- height: 100%;
69
- z-index: -1;
70
- filter: blur(10px); /* Adjust blur intensity */
71
  }}
72
- .stApp {{
73
- background: rgba(255, 255, 255, 0.8);
 
74
  padding: 20px;
75
  border-radius: 10px;
76
  }}
77
  </style>
78
- '''
79
 
80
  st.markdown(page_bg_img, unsafe_allow_html=True)
81
 
 
51
  category_idx = np.argmax(prediction, axis=1)[0]
52
  return label_encoder.inverse_transform([category_idx])[0]
53
 
54
+ # ✅ Set Background Image with Blur Effect
55
+ image_path = "News image 2.png" # Ensure this image is inside the app directory
56
 
57
+ page_bg_img = f"""
 
58
  <style>
59
+ .stApp {{
60
+ background: url('{image_path}') no-repeat center center fixed;
 
61
  background-size: cover;
62
+ filter: blur(8px); /* Adjust blur level */
 
 
 
 
 
 
63
  }}
64
+
65
+ .st-emotion-cache-10trblm {{
66
+ background: rgba(255, 255, 255, 0.8); /* Makes content readable */
67
  padding: 20px;
68
  border-radius: 10px;
69
  }}
70
  </style>
71
+ """
72
 
73
  st.markdown(page_bg_img, unsafe_allow_html=True)
74