Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,7 +83,6 @@ st.set_page_config(page_title="Newsense AI", page_icon="📰", layout="wide")
|
|
| 83 |
|
| 84 |
# return label_encoder.inverse_transform([category_idx])[0], cleaned_text
|
| 85 |
|
| 86 |
-
# Custom CSS
|
| 87 |
st.markdown(
|
| 88 |
"""
|
| 89 |
<style>
|
|
@@ -93,20 +92,24 @@ st.markdown(
|
|
| 93 |
background-repeat: no-repeat;
|
| 94 |
background-attachment: fixed;
|
| 95 |
}
|
|
|
|
|
|
|
| 96 |
.title {
|
| 97 |
font-size: 60px;
|
| 98 |
font-weight: bold;
|
| 99 |
color: white;
|
| 100 |
-
background: linear-gradient(
|
| 101 |
padding: 20px;
|
| 102 |
border-radius: 20px;
|
| 103 |
-
box-shadow: 0
|
| 104 |
-
0
|
| 105 |
display: inline-block;
|
| 106 |
-
margin-bottom:
|
| 107 |
text-align: center;
|
| 108 |
-
animation:
|
| 109 |
}
|
|
|
|
|
|
|
| 110 |
.input-box {
|
| 111 |
display: flex;
|
| 112 |
flex-direction: column;
|
|
@@ -115,63 +118,131 @@ st.markdown(
|
|
| 115 |
margin: 0 auto;
|
| 116 |
width: 80%;
|
| 117 |
}
|
|
|
|
| 118 |
.input-prompt {
|
| 119 |
-
font-size:
|
| 120 |
font-weight: bold;
|
| 121 |
color: #ffffff;
|
| 122 |
text-align: center;
|
| 123 |
-
opacity: 0.
|
|
|
|
| 124 |
}
|
|
|
|
|
|
|
| 125 |
div.stTextArea textarea {
|
| 126 |
width: 100%;
|
| 127 |
height: 200px;
|
| 128 |
padding: 20px;
|
| 129 |
border-radius: 15px;
|
| 130 |
-
background
|
| 131 |
-
color:
|
| 132 |
font-size: 18px;
|
| 133 |
outline: none;
|
| 134 |
-
box-shadow: 0
|
| 135 |
transition: all 0.5s ease;
|
| 136 |
}
|
|
|
|
| 137 |
div.stTextArea textarea:hover {
|
| 138 |
transform: scale(1.05);
|
| 139 |
-
box-shadow: 0
|
| 140 |
}
|
|
|
|
|
|
|
| 141 |
.analyze-button {
|
| 142 |
-
width:
|
| 143 |
-
height:
|
| 144 |
-
border-radius:
|
| 145 |
-
background: linear-gradient(45deg, #
|
| 146 |
-
font-size:
|
| 147 |
font-weight: bold;
|
| 148 |
-
color:
|
| 149 |
border: none;
|
| 150 |
cursor: pointer;
|
| 151 |
transition: all 0.4s ease;
|
|
|
|
| 152 |
}
|
|
|
|
| 153 |
.analyze-button:hover {
|
| 154 |
transform: scale(1.1);
|
| 155 |
-
box-shadow: 0
|
| 156 |
}
|
|
|
|
|
|
|
| 157 |
.result-box {
|
| 158 |
text-align: center;
|
| 159 |
-
font-size:
|
| 160 |
font-weight: bold;
|
| 161 |
-
color:
|
| 162 |
-
background: linear-gradient(
|
| 163 |
-
padding:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
border-radius: 20px;
|
| 165 |
-
box-shadow: 0
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
}
|
| 168 |
</style>
|
|
|
|
| 169 |
""",
|
| 170 |
unsafe_allow_html=True
|
| 171 |
)
|
| 172 |
|
| 173 |
-
# Streamlit UI layout
|
| 174 |
-
st.markdown('<div class="title">📰 Newsense AI - News Classification</div>', unsafe_allow_html=True)
|
| 175 |
|
| 176 |
# Input and button section
|
| 177 |
st.markdown('<div class="input-box">', unsafe_allow_html=True)
|
|
|
|
| 83 |
|
| 84 |
# return label_encoder.inverse_transform([category_idx])[0], cleaned_text
|
| 85 |
|
|
|
|
| 86 |
st.markdown(
|
| 87 |
"""
|
| 88 |
<style>
|
|
|
|
| 92 |
background-repeat: no-repeat;
|
| 93 |
background-attachment: fixed;
|
| 94 |
}
|
| 95 |
+
|
| 96 |
+
/* Title Styling */
|
| 97 |
.title {
|
| 98 |
font-size: 60px;
|
| 99 |
font-weight: bold;
|
| 100 |
color: white;
|
| 101 |
+
background: linear-gradient(135deg, #FF6B6B, #6B7EFF, #6BFF95, #FFDE59);
|
| 102 |
padding: 20px;
|
| 103 |
border-radius: 20px;
|
| 104 |
+
box-shadow: 0 10px 35px rgba(255, 107, 107, 0.7),
|
| 105 |
+
0 5px 20px rgba(107, 126, 255, 0.7);
|
| 106 |
display: inline-block;
|
| 107 |
+
margin-bottom: 30px;
|
| 108 |
text-align: center;
|
| 109 |
+
animation: fadeSlide 1.5s ease-out forwards;
|
| 110 |
}
|
| 111 |
+
|
| 112 |
+
/* Input Box Styling */
|
| 113 |
.input-box {
|
| 114 |
display: flex;
|
| 115 |
flex-direction: column;
|
|
|
|
| 118 |
margin: 0 auto;
|
| 119 |
width: 80%;
|
| 120 |
}
|
| 121 |
+
|
| 122 |
.input-prompt {
|
| 123 |
+
font-size: 24px;
|
| 124 |
font-weight: bold;
|
| 125 |
color: #ffffff;
|
| 126 |
text-align: center;
|
| 127 |
+
opacity: 0.9;
|
| 128 |
+
text-shadow: 0 0 8px #6BFF95;
|
| 129 |
}
|
| 130 |
+
|
| 131 |
+
/* Text Area Styling */
|
| 132 |
div.stTextArea textarea {
|
| 133 |
width: 100%;
|
| 134 |
height: 200px;
|
| 135 |
padding: 20px;
|
| 136 |
border-radius: 15px;
|
| 137 |
+
background: rgba(0, 0, 0, 0.8);
|
| 138 |
+
color: #FFFFFF;
|
| 139 |
font-size: 18px;
|
| 140 |
outline: none;
|
| 141 |
+
box-shadow: 0 8px 25px rgba(107, 126, 255, 0.5);
|
| 142 |
transition: all 0.5s ease;
|
| 143 |
}
|
| 144 |
+
|
| 145 |
div.stTextArea textarea:hover {
|
| 146 |
transform: scale(1.05);
|
| 147 |
+
box-shadow: 0 12px 40px rgba(107, 126, 255, 0.8);
|
| 148 |
}
|
| 149 |
+
|
| 150 |
+
/* Button Styling */
|
| 151 |
.analyze-button {
|
| 152 |
+
width: 220px;
|
| 153 |
+
height: 65px;
|
| 154 |
+
border-radius: 35px;
|
| 155 |
+
background: linear-gradient(45deg, #FF6B6B, #6B7EFF, #6BFF95, #FFDE59);
|
| 156 |
+
font-size: 22px;
|
| 157 |
font-weight: bold;
|
| 158 |
+
color: #000000;
|
| 159 |
border: none;
|
| 160 |
cursor: pointer;
|
| 161 |
transition: all 0.4s ease;
|
| 162 |
+
box-shadow: 0 8px 25px rgba(255, 107, 107, 0.7);
|
| 163 |
}
|
| 164 |
+
|
| 165 |
.analyze-button:hover {
|
| 166 |
transform: scale(1.1);
|
| 167 |
+
box-shadow: 0 14px 45px rgba(255, 222, 89, 0.8);
|
| 168 |
}
|
| 169 |
+
|
| 170 |
+
/* Result Box Styling */
|
| 171 |
.result-box {
|
| 172 |
text-align: center;
|
| 173 |
+
font-size: 30px;
|
| 174 |
font-weight: bold;
|
| 175 |
+
color: #ffffff;
|
| 176 |
+
background: linear-gradient(135deg, #6B7EFF, #6BFF95, #FFDE59, #FF6B6B);
|
| 177 |
+
padding: 35px;
|
| 178 |
+
border-radius: 25px;
|
| 179 |
+
box-shadow: 0 10px 30px rgba(107, 255, 107, 0.6);
|
| 180 |
+
margin-top: 40px;
|
| 181 |
+
animation: fadeIn 1.2s ease-in;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
/* Animations */
|
| 185 |
+
@keyframes fadeSlide {
|
| 186 |
+
from {
|
| 187 |
+
opacity: 0;
|
| 188 |
+
transform: translateY(-50px);
|
| 189 |
+
}
|
| 190 |
+
to {
|
| 191 |
+
opacity: 1;
|
| 192 |
+
transform: translateY(0);
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
@keyframes fadeIn {
|
| 197 |
+
from {
|
| 198 |
+
opacity: 0;
|
| 199 |
+
}
|
| 200 |
+
to {
|
| 201 |
+
opacity: 1;
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
</style>
|
| 206 |
+
""",
|
| 207 |
+
unsafe_allow_html=True
|
| 208 |
+
)
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
st.markdown(
|
| 212 |
+
"""
|
| 213 |
+
<style>
|
| 214 |
+
.title {
|
| 215 |
+
font-size: 60px;
|
| 216 |
+
font-weight: bold;
|
| 217 |
+
color: white;
|
| 218 |
+
background: linear-gradient(135deg, #FF6B6B, #6B7EFF, #6BFF95, #FFDE59);
|
| 219 |
+
padding: 20px;
|
| 220 |
border-radius: 20px;
|
| 221 |
+
box-shadow: 0 10px 35px rgba(255, 107, 107, 0.7),
|
| 222 |
+
0 5px 20px rgba(107, 126, 255, 0.7);
|
| 223 |
+
display: inline-block;
|
| 224 |
+
text-align: center;
|
| 225 |
+
margin: 0 auto; /* Center align */
|
| 226 |
+
width: fit-content; /* Adjust width to fit content */
|
| 227 |
+
animation: fadeSlide 1.5s ease-out forwards;
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
@keyframes fadeSlide {
|
| 231 |
+
from {
|
| 232 |
+
opacity: 0;
|
| 233 |
+
transform: translateY(-50px);
|
| 234 |
+
}
|
| 235 |
+
to {
|
| 236 |
+
opacity: 1;
|
| 237 |
+
transform: translateY(0);
|
| 238 |
+
}
|
| 239 |
}
|
| 240 |
</style>
|
| 241 |
+
<div class="title">📰 Newsense AI - News Classification</div>
|
| 242 |
""",
|
| 243 |
unsafe_allow_html=True
|
| 244 |
)
|
| 245 |
|
|
|
|
|
|
|
| 246 |
|
| 247 |
# Input and button section
|
| 248 |
st.markdown('<div class="input-box">', unsafe_allow_html=True)
|