Adityaganesh commited on
Commit
4326cd5
·
verified ·
1 Parent(s): f52a7f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -17
app.py CHANGED
@@ -51,25 +51,29 @@ def predict_category(text):
51
  category_idx = np.argmax(prediction, axis=1)[0]
52
  return label_encoder.inverse_transform([category_idx])[0]
53
 
54
- # Streamlit UI with Background Image
55
- st.markdown(
56
- """
57
- <style>
58
- .stApp {
59
- background-image: url("https://your-image-hosting-url.com/news-image-2.jpg");
60
- background-size: cover;
61
- background-position: center;
62
- background-repeat: no-repeat;
63
- }
64
- </style>
65
- """,
66
- unsafe_allow_html=True
67
- )
68
 
69
- st.title("News Classification App")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
- # Display local image instead (if needed)
72
- st.image("News image 2", use_column_width=True)
73
 
74
  # User input
75
  user_text = st.text_area("Enter your news content for classification.")
 
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 Background
58
+ page_bg_img = f'''
59
+ <style>
60
+ body {{
61
+ background-image: url("{image_path}");
62
+ background-size: cover;
63
+ background-position: center;
64
+ background-repeat: no-repeat;
65
+ }}
66
+ .stApp {{
67
+ background: rgba(255, 255, 255, 0.8);
68
+ padding: 20px;
69
+ border-radius: 10px;
70
+ }}
71
+ </style>
72
+ '''
73
+
74
+ st.markdown(page_bg_img, unsafe_allow_html=True)
75
 
76
+ st.title("News Classification App")
 
77
 
78
  # User input
79
  user_text = st.text_area("Enter your news content for classification.")