Spaces:
Running
Running
Update src/app.py
#27
by
KhaqanNasir
- opened
- src/app.py +20 -44
src/app.py
CHANGED
|
@@ -35,11 +35,11 @@ from src.models.hybrid_model import HybridFakeNewsDetector
|
|
| 35 |
from src.config.config import *
|
| 36 |
from src.data.preprocessor import TextPreprocessor
|
| 37 |
|
| 38 |
-
# Custom CSS
|
| 39 |
st.markdown("""
|
| 40 |
<style>
|
| 41 |
/* Import Google Fonts */
|
| 42 |
-
@import url('https://fonts.googleapis.com/css2?family=
|
| 43 |
|
| 44 |
/* Global Styles */
|
| 45 |
* {
|
|
@@ -49,7 +49,7 @@ st.markdown("""
|
|
| 49 |
}
|
| 50 |
|
| 51 |
.stApp {
|
| 52 |
-
font-family: '
|
| 53 |
background: #f8fafc;
|
| 54 |
min-height: 100vh;
|
| 55 |
color: #1a202c;
|
|
@@ -66,18 +66,18 @@ st.markdown("""
|
|
| 66 |
.container {
|
| 67 |
max-width: 1200px;
|
| 68 |
margin: 0 auto;
|
| 69 |
-
padding:
|
| 70 |
}
|
| 71 |
|
| 72 |
/* Header */
|
| 73 |
.header {
|
| 74 |
-
padding:
|
| 75 |
text-align: center;
|
| 76 |
}
|
| 77 |
|
| 78 |
.header-title {
|
| 79 |
-
font-size:
|
| 80 |
-
font-weight:
|
| 81 |
color: #1a202c;
|
| 82 |
display: inline-flex;
|
| 83 |
align-items: center;
|
|
@@ -94,7 +94,7 @@ st.markdown("""
|
|
| 94 |
|
| 95 |
.hero-left {
|
| 96 |
flex: 1;
|
| 97 |
-
padding:
|
| 98 |
}
|
| 99 |
|
| 100 |
.hero-right {
|
|
@@ -108,17 +108,18 @@ st.markdown("""
|
|
| 108 |
max-width: 100%;
|
| 109 |
height: auto;
|
| 110 |
border-radius: 8px;
|
|
|
|
| 111 |
}
|
| 112 |
|
| 113 |
.hero-title {
|
| 114 |
-
font-size:
|
| 115 |
font-weight: 700;
|
| 116 |
color: #1a202c;
|
| 117 |
margin-bottom: 0.5rem;
|
| 118 |
}
|
| 119 |
|
| 120 |
.hero-text {
|
| 121 |
-
font-size:
|
| 122 |
color: #4a5568;
|
| 123 |
line-height: 1.5;
|
| 124 |
max-width: 450px;
|
|
@@ -131,14 +132,14 @@ st.markdown("""
|
|
| 131 |
}
|
| 132 |
|
| 133 |
.about-title {
|
| 134 |
-
font-size:
|
| 135 |
font-weight: 600;
|
| 136 |
color: #1a202c;
|
| 137 |
margin-bottom: 0.5rem;
|
| 138 |
}
|
| 139 |
|
| 140 |
.about-text {
|
| 141 |
-
font-size: 1rem;
|
| 142 |
color: #4a5568;
|
| 143 |
line-height: 1.5;
|
| 144 |
max-width: 600px;
|
|
@@ -155,8 +156,8 @@ st.markdown("""
|
|
| 155 |
border-radius: 8px !important;
|
| 156 |
border: 1px solid #d1d5db !important;
|
| 157 |
padding: 1rem !important;
|
| 158 |
-
font-size: 1rem !important;
|
| 159 |
-
font-family: '
|
| 160 |
background: #ffffff !important;
|
| 161 |
min-height: 150px !important;
|
| 162 |
transition: all 0.2s ease !important;
|
|
@@ -178,9 +179,9 @@ st.markdown("""
|
|
| 178 |
color: white !important;
|
| 179 |
border-radius: 8px !important;
|
| 180 |
padding: 0.75rem 2rem !important;
|
| 181 |
-
font-size: 1rem !important;
|
| 182 |
font-weight: 600 !important;
|
| 183 |
-
font-family: '
|
| 184 |
transition: all 0.2s ease !important;
|
| 185 |
border: none !important;
|
| 186 |
width: 100% !important;
|
|
@@ -217,7 +218,7 @@ st.markdown("""
|
|
| 217 |
|
| 218 |
.prediction-badge {
|
| 219 |
font-weight: 600;
|
| 220 |
-
font-size: 1rem;
|
| 221 |
margin-bottom: 0.5rem;
|
| 222 |
display: flex;
|
| 223 |
align-items: center;
|
|
@@ -227,7 +228,7 @@ st.markdown("""
|
|
| 227 |
.confidence-score {
|
| 228 |
font-weight: 600;
|
| 229 |
margin-left: auto;
|
| 230 |
-
font-size: 1rem;
|
| 231 |
}
|
| 232 |
|
| 233 |
/* Chart Containers */
|
|
@@ -237,14 +238,6 @@ st.markdown("""
|
|
| 237 |
margin: 1rem 0;
|
| 238 |
}
|
| 239 |
|
| 240 |
-
/* Footer */
|
| 241 |
-
.footer {
|
| 242 |
-
margin-top: 2rem;
|
| 243 |
-
padding: 1rem 0;
|
| 244 |
-
text-align: center;
|
| 245 |
-
border-top: 1px solid #e5e7eb;
|
| 246 |
-
}
|
| 247 |
-
|
| 248 |
/* Sidebar Styling */
|
| 249 |
.stSidebar {
|
| 250 |
background: #ffffff;
|
|
@@ -365,16 +358,6 @@ def plot_attention(text, attention_weights):
|
|
| 365 |
return fig
|
| 366 |
|
| 367 |
def main():
|
| 368 |
-
# Sidebar
|
| 369 |
-
with st.sidebar:
|
| 370 |
-
st.markdown("## TruthCheck Menu")
|
| 371 |
-
st.markdown("Navigate through the options below:")
|
| 372 |
-
st.button("Home", disabled=True)
|
| 373 |
-
st.button("Analyze News", key="nav_analyze")
|
| 374 |
-
st.button("About", key="nav_about")
|
| 375 |
-
st.markdown("---")
|
| 376 |
-
st.markdown("**Contact**")
|
| 377 |
-
st.markdown("📧 support@truthcheck.ai")
|
| 378 |
|
| 379 |
# Header
|
| 380 |
st.markdown("""
|
|
@@ -396,7 +379,7 @@ def main():
|
|
| 396 |
</p>
|
| 397 |
</div>
|
| 398 |
<div class="hero-right">
|
| 399 |
-
<img src="https://
|
| 400 |
</div>
|
| 401 |
</div>
|
| 402 |
</div>
|
|
@@ -474,12 +457,5 @@ def main():
|
|
| 474 |
st.error("Please enter a news article (at least 10 words) for analysis.")
|
| 475 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 476 |
|
| 477 |
-
# Footer
|
| 478 |
-
st.markdown("""
|
| 479 |
-
<div class="footer">
|
| 480 |
-
<p style="text-align: center; font-weight: 600; font-size: 16px;">💻 Developed with ❤️ using Streamlit | © 2025</p>
|
| 481 |
-
</div>
|
| 482 |
-
""", unsafe_allow_html=True)
|
| 483 |
-
|
| 484 |
if __name__ == "__main__":
|
| 485 |
main()
|
|
|
|
| 35 |
from src.config.config import *
|
| 36 |
from src.data.preprocessor import TextPreprocessor
|
| 37 |
|
| 38 |
+
# Custom CSS with Poppins font and increased font sizes
|
| 39 |
st.markdown("""
|
| 40 |
<style>
|
| 41 |
/* Import Google Fonts */
|
| 42 |
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
|
| 43 |
|
| 44 |
/* Global Styles */
|
| 45 |
* {
|
|
|
|
| 49 |
}
|
| 50 |
|
| 51 |
.stApp {
|
| 52 |
+
font-family: 'Poppins', sans-serif;
|
| 53 |
background: #f8fafc;
|
| 54 |
min-height: 100vh;
|
| 55 |
color: #1a202c;
|
|
|
|
| 66 |
.container {
|
| 67 |
max-width: 1200px;
|
| 68 |
margin: 0 auto;
|
| 69 |
+
padding: 1.5rem;
|
| 70 |
}
|
| 71 |
|
| 72 |
/* Header */
|
| 73 |
.header {
|
| 74 |
+
padding: 1.5rem 0;
|
| 75 |
text-align: center;
|
| 76 |
}
|
| 77 |
|
| 78 |
.header-title {
|
| 79 |
+
font-size: 2.5rem;
|
| 80 |
+
font-weight: 700;
|
| 81 |
color: #1a202c;
|
| 82 |
display: inline-flex;
|
| 83 |
align-items: center;
|
|
|
|
| 94 |
|
| 95 |
.hero-left {
|
| 96 |
flex: 1;
|
| 97 |
+
padding: 1.5rem;
|
| 98 |
}
|
| 99 |
|
| 100 |
.hero-right {
|
|
|
|
| 108 |
max-width: 100%;
|
| 109 |
height: auto;
|
| 110 |
border-radius: 8px;
|
| 111 |
+
object-fit: cover;
|
| 112 |
}
|
| 113 |
|
| 114 |
.hero-title {
|
| 115 |
+
font-size: 3rem;
|
| 116 |
font-weight: 700;
|
| 117 |
color: #1a202c;
|
| 118 |
margin-bottom: 0.5rem;
|
| 119 |
}
|
| 120 |
|
| 121 |
.hero-text {
|
| 122 |
+
font-size: 1.2rem;
|
| 123 |
color: #4a5568;
|
| 124 |
line-height: 1.5;
|
| 125 |
max-width: 450px;
|
|
|
|
| 132 |
}
|
| 133 |
|
| 134 |
.about-title {
|
| 135 |
+
font-size: 2.2rem;
|
| 136 |
font-weight: 600;
|
| 137 |
color: #1a202c;
|
| 138 |
margin-bottom: 0.5rem;
|
| 139 |
}
|
| 140 |
|
| 141 |
.about-text {
|
| 142 |
+
font-size: 1.1rem;
|
| 143 |
color: #4a5568;
|
| 144 |
line-height: 1.5;
|
| 145 |
max-width: 600px;
|
|
|
|
| 156 |
border-radius: 8px !important;
|
| 157 |
border: 1px solid #d1d5db !important;
|
| 158 |
padding: 1rem !important;
|
| 159 |
+
font-size: 1.1rem !important;
|
| 160 |
+
font-family: 'Poppins', sans-serif !important;
|
| 161 |
background: #ffffff !important;
|
| 162 |
min-height: 150px !important;
|
| 163 |
transition: all 0.2s ease !important;
|
|
|
|
| 179 |
color: white !important;
|
| 180 |
border-radius: 8px !important;
|
| 181 |
padding: 0.75rem 2rem !important;
|
| 182 |
+
font-size: 1.1rem !important;
|
| 183 |
font-weight: 600 !important;
|
| 184 |
+
font-family: 'Poppins', sans-serif !important;
|
| 185 |
transition: all 0.2s ease !important;
|
| 186 |
border: none !important;
|
| 187 |
width: 100% !important;
|
|
|
|
| 218 |
|
| 219 |
.prediction-badge {
|
| 220 |
font-weight: 600;
|
| 221 |
+
font-size: 1.1rem;
|
| 222 |
margin-bottom: 0.5rem;
|
| 223 |
display: flex;
|
| 224 |
align-items: center;
|
|
|
|
| 228 |
.confidence-score {
|
| 229 |
font-weight: 600;
|
| 230 |
margin-left: auto;
|
| 231 |
+
font-size: 1.1rem;
|
| 232 |
}
|
| 233 |
|
| 234 |
/* Chart Containers */
|
|
|
|
| 238 |
margin: 1rem 0;
|
| 239 |
}
|
| 240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
/* Sidebar Styling */
|
| 242 |
.stSidebar {
|
| 243 |
background: #ffffff;
|
|
|
|
| 358 |
return fig
|
| 359 |
|
| 360 |
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
|
| 362 |
# Header
|
| 363 |
st.markdown("""
|
|
|
|
| 379 |
</p>
|
| 380 |
</div>
|
| 381 |
<div class="hero-right">
|
| 382 |
+
<img src="https://images.unsplash.com/photo-1593642532973-d31b97d0fad2?ixlib=rb-4.0.3&auto=format&fit=crop&w=500&q=80" alt="Fake News Detector" onerror="this.src='https://via.placeholder.com/500x300.png?text=Fake+News+Detector'">
|
| 383 |
</div>
|
| 384 |
</div>
|
| 385 |
</div>
|
|
|
|
| 457 |
st.error("Please enter a news article (at least 10 words) for analysis.")
|
| 458 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 459 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
if __name__ == "__main__":
|
| 461 |
main()
|