Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
from typing import Union, List, Dict
|
|
@@ -7,7 +8,7 @@ from duckduckgo_search import DDGS
|
|
| 7 |
|
| 8 |
# Set page configuration with fullscreen layout and custom theme
|
| 9 |
st.set_page_config(
|
| 10 |
-
page_title="Z-
|
| 11 |
layout="wide",
|
| 12 |
initial_sidebar_state="collapsed",
|
| 13 |
page_icon="π"
|
|
@@ -25,7 +26,7 @@ st.markdown("""
|
|
| 25 |
</script>
|
| 26 |
""", unsafe_allow_html=True)
|
| 27 |
|
| 28 |
-
# Enhanced CSS for a more beautiful Google DeepMind-inspired styling
|
| 29 |
st.markdown("""
|
| 30 |
<style>
|
| 31 |
/* Global font and color scheme */
|
|
@@ -35,9 +36,9 @@ st.markdown("""
|
|
| 35 |
font-family: 'Inter', sans-serif;
|
| 36 |
}
|
| 37 |
|
| 38 |
-
/* Background and main container styling */
|
| 39 |
.main {
|
| 40 |
-
background: linear-gradient(135deg, #
|
| 41 |
padding: 0;
|
| 42 |
}
|
| 43 |
|
|
@@ -49,7 +50,7 @@ st.markdown("""
|
|
| 49 |
|
| 50 |
/* Header styling */
|
| 51 |
h1 {
|
| 52 |
-
color: #
|
| 53 |
font-weight: 700 !important;
|
| 54 |
margin-bottom: 1rem !important;
|
| 55 |
letter-spacing: -0.5px;
|
|
@@ -58,7 +59,7 @@ st.markdown("""
|
|
| 58 |
|
| 59 |
h2 {
|
| 60 |
font-weight: 600 !important;
|
| 61 |
-
color: #
|
| 62 |
letter-spacing: -0.3px;
|
| 63 |
font-size: 1.8rem !important;
|
| 64 |
margin-top: 1.5rem !important;
|
|
@@ -66,7 +67,7 @@ st.markdown("""
|
|
| 66 |
|
| 67 |
h3 {
|
| 68 |
font-weight: 600 !important;
|
| 69 |
-
color: #
|
| 70 |
letter-spacing: -0.2px;
|
| 71 |
font-size: 1.4rem !important;
|
| 72 |
}
|
|
@@ -87,9 +88,9 @@ st.markdown("""
|
|
| 87 |
transform: translateY(-3px);
|
| 88 |
}
|
| 89 |
|
| 90 |
-
/* Button styling */
|
| 91 |
.stButton > button {
|
| 92 |
-
background: linear-gradient(90deg, #
|
| 93 |
color: white;
|
| 94 |
border: none;
|
| 95 |
border-radius: 8px;
|
|
@@ -100,12 +101,12 @@ st.markdown("""
|
|
| 100 |
text-transform: uppercase;
|
| 101 |
letter-spacing: 0.5px;
|
| 102 |
font-size: 1rem;
|
| 103 |
-
box-shadow: 0 4px 12px rgba(
|
| 104 |
}
|
| 105 |
|
| 106 |
.stButton > button:hover {
|
| 107 |
-
background: linear-gradient(90deg, #
|
| 108 |
-
box-shadow: 0 6px 16px rgba(
|
| 109 |
transform: translateY(-2px);
|
| 110 |
}
|
| 111 |
|
|
@@ -123,8 +124,8 @@ st.markdown("""
|
|
| 123 |
}
|
| 124 |
|
| 125 |
.stTextInput input:focus {
|
| 126 |
-
border-color: #
|
| 127 |
-
box-shadow: 0 0 0 4px rgba(
|
| 128 |
}
|
| 129 |
|
| 130 |
.stSelectbox div[data-baseweb="select"] div {
|
|
@@ -134,8 +135,8 @@ st.markdown("""
|
|
| 134 |
}
|
| 135 |
|
| 136 |
.stSelectbox div[data-baseweb="select"] div:focus {
|
| 137 |
-
border-color: #
|
| 138 |
-
box-shadow: 0 0 0 4px rgba(
|
| 139 |
}
|
| 140 |
|
| 141 |
.stSlider div[data-baseweb="slider"] {
|
|
@@ -147,7 +148,7 @@ st.markdown("""
|
|
| 147 |
background-color: #F8F9FA;
|
| 148 |
border-radius: 12px;
|
| 149 |
padding: 2rem;
|
| 150 |
-
border-left: 6px solid #
|
| 151 |
line-height: 1.7;
|
| 152 |
}
|
| 153 |
|
|
@@ -167,7 +168,7 @@ st.markdown("""
|
|
| 167 |
|
| 168 |
/* Spinner/progress styling */
|
| 169 |
.stSpinner > div {
|
| 170 |
-
border-color: #
|
| 171 |
border-width: 3px !important;
|
| 172 |
}
|
| 173 |
|
|
@@ -179,15 +180,15 @@ st.markdown("""
|
|
| 179 |
font-size: 0.9rem;
|
| 180 |
}
|
| 181 |
|
| 182 |
-
/* Logo and branding */
|
| 183 |
.logo-text {
|
| 184 |
font-weight: 700;
|
| 185 |
-
background: linear-gradient(90deg, #
|
| 186 |
-webkit-background-clip: text;
|
| 187 |
-webkit-text-fill-color: transparent;
|
| 188 |
font-size: 2.8rem;
|
| 189 |
letter-spacing: -1px;
|
| 190 |
-
text-shadow: 0px 4px 8px rgba(
|
| 191 |
}
|
| 192 |
|
| 193 |
/* Sections */
|
|
@@ -196,21 +197,21 @@ st.markdown("""
|
|
| 196 |
font-weight: 600;
|
| 197 |
margin-top: 2rem;
|
| 198 |
margin-bottom: 1.2rem;
|
| 199 |
-
color: #
|
| 200 |
padding-bottom: 0.5rem;
|
| 201 |
-
border-bottom: 2px solid #
|
| 202 |
}
|
| 203 |
|
| 204 |
/* Source links */
|
| 205 |
a {
|
| 206 |
-
color: #
|
| 207 |
text-decoration: none;
|
| 208 |
transition: all 0.2s;
|
| 209 |
font-weight: 500;
|
| 210 |
}
|
| 211 |
|
| 212 |
a:hover {
|
| 213 |
-
color: #
|
| 214 |
text-decoration: underline;
|
| 215 |
}
|
| 216 |
|
|
@@ -233,7 +234,7 @@ st.markdown("""
|
|
| 233 |
|
| 234 |
.stTabs [aria-selected="true"] {
|
| 235 |
background-color: white !important;
|
| 236 |
-
color: #
|
| 237 |
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
| 238 |
}
|
| 239 |
|
|
@@ -243,12 +244,12 @@ st.markdown("""
|
|
| 243 |
|
| 244 |
/* Info boxes */
|
| 245 |
.info-box {
|
| 246 |
-
background-color: #
|
| 247 |
border-radius: 12px;
|
| 248 |
padding: 1.2rem;
|
| 249 |
-
border-left: 6px solid #
|
| 250 |
margin-bottom: 1.5rem;
|
| 251 |
-
box-shadow: 0 4px 12px rgba(
|
| 252 |
}
|
| 253 |
|
| 254 |
/* Progress animation */
|
|
@@ -321,13 +322,13 @@ st.markdown("""
|
|
| 321 |
}
|
| 322 |
|
| 323 |
.status-searching {
|
| 324 |
-
background-color: #
|
| 325 |
-
color: #
|
| 326 |
}
|
| 327 |
|
| 328 |
.status-analyzing {
|
| 329 |
background-color: #e6f4ea;
|
| 330 |
-
color: #
|
| 331 |
}
|
| 332 |
|
| 333 |
/* Header icon animation */
|
|
@@ -350,7 +351,7 @@ st.markdown("""
|
|
| 350 |
}
|
| 351 |
|
| 352 |
.tip-icon {
|
| 353 |
-
color: #
|
| 354 |
font-size: 1.2rem;
|
| 355 |
margin-top: 0.2rem;
|
| 356 |
}
|
|
@@ -361,6 +362,7 @@ st.markdown("""
|
|
| 361 |
</style>
|
| 362 |
""", unsafe_allow_html=True)
|
| 363 |
|
|
|
|
| 364 |
class DuckDuckGoSearch:
|
| 365 |
"""
|
| 366 |
Custom DuckDuckGo search implementation with robust error handling and result processing.
|
|
|
|
| 1 |
+
|
| 2 |
import streamlit as st
|
| 3 |
import pandas as pd
|
| 4 |
from typing import Union, List, Dict
|
|
|
|
| 8 |
|
| 9 |
# Set page configuration with fullscreen layout and custom theme
|
| 10 |
st.set_page_config(
|
| 11 |
+
page_title="Z-Alpha News Analysis",
|
| 12 |
layout="wide",
|
| 13 |
initial_sidebar_state="collapsed",
|
| 14 |
page_icon="π"
|
|
|
|
| 26 |
</script>
|
| 27 |
""", unsafe_allow_html=True)
|
| 28 |
|
| 29 |
+
# Enhanced CSS for a more beautiful Google DeepMind-inspired styling with green background
|
| 30 |
st.markdown("""
|
| 31 |
<style>
|
| 32 |
/* Global font and color scheme */
|
|
|
|
| 36 |
font-family: 'Inter', sans-serif;
|
| 37 |
}
|
| 38 |
|
| 39 |
+
/* Background and main container styling - Changed to green gradient */
|
| 40 |
.main {
|
| 41 |
+
background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
|
| 42 |
padding: 0;
|
| 43 |
}
|
| 44 |
|
|
|
|
| 50 |
|
| 51 |
/* Header styling */
|
| 52 |
h1 {
|
| 53 |
+
color: #0b5027;
|
| 54 |
font-weight: 700 !important;
|
| 55 |
margin-bottom: 1rem !important;
|
| 56 |
letter-spacing: -0.5px;
|
|
|
|
| 59 |
|
| 60 |
h2 {
|
| 61 |
font-weight: 600 !important;
|
| 62 |
+
color: #1b5e20;
|
| 63 |
letter-spacing: -0.3px;
|
| 64 |
font-size: 1.8rem !important;
|
| 65 |
margin-top: 1.5rem !important;
|
|
|
|
| 67 |
|
| 68 |
h3 {
|
| 69 |
font-weight: 600 !important;
|
| 70 |
+
color: #2e7d32;
|
| 71 |
letter-spacing: -0.2px;
|
| 72 |
font-size: 1.4rem !important;
|
| 73 |
}
|
|
|
|
| 88 |
transform: translateY(-3px);
|
| 89 |
}
|
| 90 |
|
| 91 |
+
/* Button styling - Changed to green gradient */
|
| 92 |
.stButton > button {
|
| 93 |
+
background: linear-gradient(90deg, #2e7d32, #1b5e20);
|
| 94 |
color: white;
|
| 95 |
border: none;
|
| 96 |
border-radius: 8px;
|
|
|
|
| 101 |
text-transform: uppercase;
|
| 102 |
letter-spacing: 0.5px;
|
| 103 |
font-size: 1rem;
|
| 104 |
+
box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
|
| 105 |
}
|
| 106 |
|
| 107 |
.stButton > button:hover {
|
| 108 |
+
background: linear-gradient(90deg, #388e3c, #2e7d32);
|
| 109 |
+
box-shadow: 0 6px 16px rgba(46, 125, 50, 0.4);
|
| 110 |
transform: translateY(-2px);
|
| 111 |
}
|
| 112 |
|
|
|
|
| 124 |
}
|
| 125 |
|
| 126 |
.stTextInput input:focus {
|
| 127 |
+
border-color: #2e7d32;
|
| 128 |
+
box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.2);
|
| 129 |
}
|
| 130 |
|
| 131 |
.stSelectbox div[data-baseweb="select"] div {
|
|
|
|
| 135 |
}
|
| 136 |
|
| 137 |
.stSelectbox div[data-baseweb="select"] div:focus {
|
| 138 |
+
border-color: #2e7d32;
|
| 139 |
+
box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.2);
|
| 140 |
}
|
| 141 |
|
| 142 |
.stSlider div[data-baseweb="slider"] {
|
|
|
|
| 148 |
background-color: #F8F9FA;
|
| 149 |
border-radius: 12px;
|
| 150 |
padding: 2rem;
|
| 151 |
+
border-left: 6px solid #2e7d32;
|
| 152 |
line-height: 1.7;
|
| 153 |
}
|
| 154 |
|
|
|
|
| 168 |
|
| 169 |
/* Spinner/progress styling */
|
| 170 |
.stSpinner > div {
|
| 171 |
+
border-color: #2e7d32 transparent transparent !important;
|
| 172 |
border-width: 3px !important;
|
| 173 |
}
|
| 174 |
|
|
|
|
| 180 |
font-size: 0.9rem;
|
| 181 |
}
|
| 182 |
|
| 183 |
+
/* Logo and branding - Changed to green gradient */
|
| 184 |
.logo-text {
|
| 185 |
font-weight: 700;
|
| 186 |
+
background: linear-gradient(90deg, #2e7d32, #81c784);
|
| 187 |
-webkit-background-clip: text;
|
| 188 |
-webkit-text-fill-color: transparent;
|
| 189 |
font-size: 2.8rem;
|
| 190 |
letter-spacing: -1px;
|
| 191 |
+
text-shadow: 0px 4px 8px rgba(46, 125, 50, 0.2);
|
| 192 |
}
|
| 193 |
|
| 194 |
/* Sections */
|
|
|
|
| 197 |
font-weight: 600;
|
| 198 |
margin-top: 2rem;
|
| 199 |
margin-bottom: 1.2rem;
|
| 200 |
+
color: #1b5e20;
|
| 201 |
padding-bottom: 0.5rem;
|
| 202 |
+
border-bottom: 2px solid #c8e6c9;
|
| 203 |
}
|
| 204 |
|
| 205 |
/* Source links */
|
| 206 |
a {
|
| 207 |
+
color: #2e7d32;
|
| 208 |
text-decoration: none;
|
| 209 |
transition: all 0.2s;
|
| 210 |
font-weight: 500;
|
| 211 |
}
|
| 212 |
|
| 213 |
a:hover {
|
| 214 |
+
color: #1b5e20;
|
| 215 |
text-decoration: underline;
|
| 216 |
}
|
| 217 |
|
|
|
|
| 234 |
|
| 235 |
.stTabs [aria-selected="true"] {
|
| 236 |
background-color: white !important;
|
| 237 |
+
color: #2e7d32 !important;
|
| 238 |
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
| 239 |
}
|
| 240 |
|
|
|
|
| 244 |
|
| 245 |
/* Info boxes */
|
| 246 |
.info-box {
|
| 247 |
+
background-color: #e8f5e9;
|
| 248 |
border-radius: 12px;
|
| 249 |
padding: 1.2rem;
|
| 250 |
+
border-left: 6px solid #2e7d32;
|
| 251 |
margin-bottom: 1.5rem;
|
| 252 |
+
box-shadow: 0 4px 12px rgba(46, 125, 50, 0.15);
|
| 253 |
}
|
| 254 |
|
| 255 |
/* Progress animation */
|
|
|
|
| 322 |
}
|
| 323 |
|
| 324 |
.status-searching {
|
| 325 |
+
background-color: #e8f5e9;
|
| 326 |
+
color: #2e7d32;
|
| 327 |
}
|
| 328 |
|
| 329 |
.status-analyzing {
|
| 330 |
background-color: #e6f4ea;
|
| 331 |
+
color: #1b5e20;
|
| 332 |
}
|
| 333 |
|
| 334 |
/* Header icon animation */
|
|
|
|
| 351 |
}
|
| 352 |
|
| 353 |
.tip-icon {
|
| 354 |
+
color: #2e7d32;
|
| 355 |
font-size: 1.2rem;
|
| 356 |
margin-top: 0.2rem;
|
| 357 |
}
|
|
|
|
| 362 |
</style>
|
| 363 |
""", unsafe_allow_html=True)
|
| 364 |
|
| 365 |
+
|
| 366 |
class DuckDuckGoSearch:
|
| 367 |
"""
|
| 368 |
Custom DuckDuckGo search implementation with robust error handling and result processing.
|