Spaces:
Sleeping
Sleeping
File size: 21,809 Bytes
88b25bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | import gradio as gr
import pandas as pd
from datetime import datetime
# Enhanced CSS with premium design and maximum readability
custom_css = """
/* Light mode variables with enhanced contrast */
:root {
--primary-green: #1a4d2e;
--secondary-green: #2d5a3d;
--tertiary-green: #4a7c59;
--accent-green: #6bb26b;
--light-green: #8bc68b;
--forest-green: #0f2818;
--mint-green: #9dd49d;
--emerald-green: #50c878;
--neon-green: #39ff14;
/* High contrast text colors */
--text-primary: #0d1a0d;
--text-secondary: #1a2e1a;
--text-accent: #2d5a3d;
--text-light: #ffffff;
--text-muted: #4a7c59;
/* Enhanced background colors */
--bg-primary: #ffffff;
--bg-secondary: #f8fdf8;
--bg-tertiary: #ecf8ec;
--bg-card: #ffffff;
--bg-hover: #e8f5e8;
--bg-gradient: linear-gradient(135deg, #f8fdf8 0%, #ecf8ec 100%);
/* Enhanced shadows and effects */
--border-color: #6bb26b;
--shadow-light: rgba(26, 77, 46, 0.08);
--shadow-medium: rgba(26, 77, 46, 0.15);
--shadow-heavy: rgba(26, 77, 46, 0.25);
--shadow-glow: 0 0 30px rgba(57, 255, 20, 0.3);
}
/* Dark mode variables */
@media (prefers-color-scheme: dark) {
:root {
--primary-green: #4a9d4a;
--secondary-green: #6bb26b;
--tertiary-green: #8bc68b;
--accent-green: #9dd49d;
--light-green: #b8e6b8;
--forest-green: #2d5a3d;
--mint-green: #6b9279;
--emerald-green: #7fbc7f;
/* Text colors for dark mode */
--text-primary: #e8f5e8;
--text-secondary: #d0e8d0;
--text-light: #ffffff;
/* Background colors for dark mode */
--bg-primary: #1a1f1a;
--bg-secondary: #212621;
--bg-tertiary: #2d332d;
--bg-card: #262b26;
--bg-hover: #333833;
/* Border and shadow for dark mode */
--border-color: #6bb26b;
--shadow-light: rgba(74, 157, 74, 0.15);
--shadow-medium: rgba(74, 157, 74, 0.25);
--shadow-heavy: rgba(74, 157, 74, 0.35);
}
}
/* Global body styling */
body {
background: var(--bg-primary) !important;
color: var(--text-primary) !important;
transition: all 0.3s ease;
}
/* Gradio container styling */
.gradio-container {
background: var(--bg-primary) !important;
color: var(--text-primary) !important;
}
/* Header styling with enhanced green gradients */
.header-container {
background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 50%, var(--tertiary-green) 100%);
color: var(--text-light);
padding: 3rem 2rem;
text-align: center;
margin-bottom: 2rem;
border-radius: 16px;
box-shadow: 0 8px 32px var(--shadow-heavy);
border: 1px solid var(--accent-green);
position: relative;
overflow: hidden;
}
.header-container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
pointer-events: none;
}
.header-title {
font-size: 3rem;
font-weight: 800;
margin-bottom: 0.8rem;
display: flex;
align-items: center;
justify-content: center;
gap: 15px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.header-subtitle {
font-size: 1.4rem;
opacity: 0.95;
margin-bottom: 1rem;
font-weight: 500;
}
/* Enhanced feature cards */
.feature-card {
background: var(--bg-card);
border: 2px solid var(--accent-green);
border-radius: 16px;
padding: 2rem;
margin: 1.5rem 0;
box-shadow: 0 6px 20px var(--shadow-light);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
position: relative;
overflow: hidden;
}
.feature-card::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, var(--mint-green), transparent);
opacity: 0.1;
transition: left 0.6s ease;
}
.feature-card:hover::before {
left: 100%;
}
.feature-card:hover {
transform: translateY(-8px) scale(1.02);
box-shadow: 0 12px 40px var(--shadow-medium);
border-color: var(--emerald-green);
}
.feature-title {
color: var(--primary-green);
font-size: 1.6rem;
font-weight: 700;
margin-bottom: 1rem;
display: flex;
align-items: center;
gap: 12px;
}
.feature-description {
color: var(--text-secondary);
line-height: 1.8;
margin-bottom: 1.2rem;
font-size: 1.1rem;
}
.feature-list {
color: var(--text-secondary);
margin-left: 1.5rem;
line-height: 1.8;
}
/* Enhanced coming soon section */
.coming-soon {
background: linear-gradient(135deg, var(--forest-green) 0%, var(--primary-green) 50%, var(--secondary-green) 100%);
color: var(--text-light);
padding: 3rem;
border-radius: 20px;
text-align: center;
margin: 3rem 0;
box-shadow: 0 10px 40px var(--shadow-heavy);
border: 2px solid var(--emerald-green);
position: relative;
overflow: hidden;
}
.coming-soon::before {
content: 'π';
position: absolute;
top: 20px;
right: 20px;
font-size: 2rem;
opacity: 0.3;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 0.3; }
50% { transform: scale(1.1); opacity: 0.6; }
}
.coming-soon-title {
font-size: 2.2rem;
font-weight: 800;
margin-bottom: 1.5rem;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
/* Enhanced founder section */
.founder-section {
background: var(--bg-secondary);
border: 3px solid var(--accent-green);
border-radius: 16px;
padding: 2.5rem;
margin: 3rem 0;
box-shadow: 0 8px 30px var(--shadow-light);
position: relative;
}
.founder-section::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
background: linear-gradient(45deg, var(--primary-green), var(--accent-green), var(--emerald-green), var(--primary-green));
border-radius: 16px;
z-index: -1;
opacity: 0.1;
}
.founder-title {
color: var(--primary-green);
font-size: 1.8rem;
font-weight: 700;
margin-bottom: 1.5rem;
}
/* Enhanced button styling */
.demo-button {
background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%) !important;
color: var(--text-light) !important;
border: 2px solid var(--accent-green) !important;
padding: 15px 30px !important;
border-radius: 12px !important;
font-weight: 700 !important;
font-size: 1.1rem !important;
transition: all 0.3s ease !important;
box-shadow: 0 4px 15px var(--shadow-light) !important;
text-transform: uppercase !important;
letter-spacing: 0.5px !important;
}
.demo-button:hover {
background: linear-gradient(135deg, var(--secondary-green) 0%, var(--tertiary-green) 100%) !important;
transform: translateY(-2px) !important;
box-shadow: 0 8px 25px var(--shadow-medium) !important;
border-color: var(--emerald-green) !important;
}
/* Enhanced stats/how-to-use grid */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
margin: 3rem 0;
}
.stat-card {
background: var(--bg-card);
border: 2px solid var(--accent-green);
border-radius: 16px;
padding: 2rem 1.5rem;
text-align: center;
transition: all 0.3s ease;
box-shadow: 0 6px 20px var(--shadow-light);
position: relative;
overflow: hidden;
}
.stat-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, var(--primary-green), var(--accent-green), var(--emerald-green));
}
.stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 12px 35px var(--shadow-medium);
border-color: var(--emerald-green);
}
.stat-number {
color: var(--primary-green);
font-size: 2.5rem;
font-weight: 800;
margin-bottom: 0.5rem;
text-shadow: 1px 1px 2px var(--shadow-light);
}
.stat-label {
color: var(--text-secondary);
font-size: 1rem;
margin-top: 0.8rem;
line-height: 1.6;
font-weight: 500;
}
/* Section headers */
h2 {
color: var(--primary-green) !important;
font-weight: 700 !important;
text-shadow: 1px 1px 2px var(--shadow-light) !important;
}
/* Responsive design */
@media (max-width: 768px) {
.header-title {
font-size: 2.2rem;
}
.stats-grid {
grid-template-columns: 1fr;
gap: 1rem;
}
.feature-card {
padding: 1.5rem;
}
}
/* Scrollbar styling */
::-webkit-scrollbar {
width: 12px;
}
::-webkit-scrollbar-track {
background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
background: var(--accent-green);
border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--primary-green);
}
"""
def create_main_content():
return """
<div class="header-container">
<div class="header-title" style="color: #ffffff !important;">
πΎ Shafaq's AgriWeather Hub
</div>
<div class="header-subtitle" style="color: #ffffff !important;">
Real-time Weather Data & Smart Farming Assistant
</div>
<p style="color: #ffffff !important; font-size: 1.3rem; font-weight: 500;">Empowering farmers with precision agriculture through intelligent weather insights and crop management tools</p>
</div>
"""
def create_features_section():
return """
<div class="feature-card">
<div class="feature-title">
π€οΈ Real-Time Weather Dashboard
</div>
<div class="feature-description">
Get comprehensive weather data tailored for agricultural needs with location-specific insights for optimal farming decisions.
</div>
<div class="feature-list">
β’ Live temperature, humidity, and precipitation data<br>
β’ Wind speed and pressure monitoring<br>
β’ UV index and visibility tracking<br>
β’ 7-day detailed weather forecasts<br>
β’ Agricultural weather alerts and warnings
</div>
</div>
<div class="feature-card">
<div class="feature-title">
π€ AgriBot Assistant
</div>
<div class="feature-description">
Your personal farming advisor powered by AI, providing expert guidance on irrigation, crop management, and seasonal planning.
</div>
<div class="feature-list">
β’ Smart irrigation scheduling recommendations<br>
β’ Crop-specific growing advice and tips<br>
β’ Pest and disease identification support<br>
β’ Soil health and nutrient management guidance<br>
β’ Seasonal farming calendar and reminders
</div>
</div>
<div class="feature-card">
<div class="feature-title">
π± Crop Intelligence System
</div>
<div class="feature-description">
Discover the best crops for your region with detailed growing guides and environmental condition matching.
</div>
<div class="feature-list">
β’ Region-specific crop recommendations<br>
β’ Detailed growing conditions and requirements<br>
β’ Seasonal planting and harvesting schedules<br>
β’ Yield optimization strategies<br>
β’ Market price trends and analysis
</div>
</div>
"""
def create_coming_soon_section():
return """
<div class="coming-soon">
<div class="coming-soon-title" style="color: #ffffff !important;">
π Coming Soon: Advanced Features
</div>
<div style="font-size: 1.1rem; line-height: 1.6; color: #ffffff !important;">
<strong style="color: #ffffff !important;">π¬ AI-Powered Plant Doctor</strong><br>
<span style="color: #ffffff !important;">Advanced plant identification system that helps diagnose diseases, identify pests, and provides detailed treatment recommendations with step-by-step cure guides</span>
<br><br>
<strong style="color: #ffffff !important;">π± Mobile App with Offline Capabilities</strong><br>
<span style="color: #ffffff !important;">Take AgriWeather Hub with you to the field, even without internet connectivity</span>
<br><br>
<strong style="color: #ffffff !important;">π Community Farming Network</strong><br>
<span style="color: #ffffff !important;">Connect with local farmers, share insights, and access cooperative farming resources</span>
</div>
</div>
"""
def create_founder_section():
return """
<div class="founder-section">
<div class="founder-title">
π¨βπΎ Meet the Visionary Behind AgriWeather Hub
</div>
<div style="line-height: 2; color: var(--text-primary); font-size: 1.2rem; font-weight: 500;">
<strong style="font-size: 1.4rem; color: var(--primary-green);">Shafaq</strong> is a passionate agricultural technology innovator with a deep understanding of modern farming challenges. With a background in both technology and agriculture, Shafaq recognized the critical need for accessible, intelligent farming tools that could help farmers make data-driven decisions.
<br><br>
<strong style="color: var(--primary-green); font-size: 1.3rem;">π― Vision:</strong> "To democratize precision agriculture by making advanced weather intelligence and farming insights accessible to farmers of all scales, from smallholder farms to large agricultural enterprises."
<br><br>
<strong style="color: var(--primary-green); font-size: 1.3rem;">π Mission:</strong> Bridging the gap between traditional farming wisdom and modern technology to create sustainable, profitable, and environmentally conscious agricultural practices.
<br><br>
<strong style="color: #000000 !important; font-size: 1.3rem;">π Background:</strong>
<div style="margin-left: 1rem; margin-top: 1rem;">
<span style="color: #000000 !important; font-weight: normal !important;">β’ π Agricultural Engineering & Data Science</span><br>
<span style="color: #000000 !important; font-weight: normal !important;">β’ πΎ 5+ years in precision agriculture research</span><br>
<span style="color: #000000 !important; font-weight: normal !important;">β’ π‘ Multiple agricultural innovation awards</span><br>
<span style="color: #000000 !important; font-weight: normal !important;">β’ π€ Collaborated with farming communities across diverse climates</span><br>
<span style="color: #000000 !important; font-weight: normal !important;">β’ π± Advocate for sustainable farming practices</span>
</div>
</div>
</div>
"""
def create_how_to_use_section():
return """
<div class="stats-grid">
<div class="stat-card">
<div class="stat-number">1οΈβ£</div>
<div class="stat-label"><strong style="color: #000000 !important;">Enter Your Location</strong><br><span style="color: #000000 !important;">Simply input your city or coordinates to get localized weather data</span></div>
</div>
<div class="stat-card">
<div class="stat-number" style="color: #000000 !important;">2οΈβ£</div>
<div class="stat-label"><strong style="color: #000000 !important;">Choose Your Crops</strong><br><span style="color: #000000 !important;">Select from our extensive crop database for personalized recommendations</span></div>
</div>
<div class="stat-card">
<div class="stat-number" style="color: #000000 !important;">3οΈβ£</div>
<div class="stat-label"><strong style="color: #000000 !important;">Get Smart Insights</strong><br><span style="color: #000000 !important;">Receive AI-powered farming advice and weather-based recommendations</span></div>
</div>
<div class="stat-card">
<div class="stat-number" style="color: #000000 !important;">4οΈβ£</div>
<div class="stat-label"><strong style="color: #000000 !important;">Take Action</strong><br><span style="color: #000000 !important;">Implement suggested irrigation, planting, and harvesting schedules</span></div>
</div>
</div>
"""
def launch_demo():
return "π Launching AgriWeather Hub Demo... Please wait while we redirect you to the full application!"
def connect_with_founder():
# JavaScript to open LinkedIn in new tab
linkedin_url = "https://www.linkedin.com/in/shafaq-mandha-a0b2a4280/"
js_code = f"""
<script>
window.open('{linkedin_url}', '_blank');
</script>
"""
return js_code
# Create the Gradio interface
with gr.Blocks(css=custom_css, title="Shafaq's AgriWeather Hub") as demo:
# Main header
gr.HTML(create_main_content())
# How to Use section
gr.HTML("<h2 style='color: #4a7c59; text-align: center; margin: 2rem 0;'>π How to Use AgriWeather Hub</h2>")
gr.HTML(create_how_to_use_section())
# Features section
with gr.Row():
with gr.Column():
gr.HTML("<h2 style='color: #4a7c59; text-align: center; margin: 2rem 0;'>π Core Features</h2>")
gr.HTML(create_features_section())
# Coming soon section
gr.HTML(create_coming_soon_section())
# About founder section
gr.HTML(create_founder_section())
# Action buttons
with gr.Row():
with gr.Column():
gr.HTML("""
<a href="https://huggingface.co/spaces/Shafaq25/AgriWeather_Hub" target="_blank" style="text-decoration: none;">
<button class="demo-button" style="
background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 50%, var(--emerald-green) 100%) !important;
color: #ffffff !important;
border: 3px solid var(--neon-green) !important;
padding: 20px 40px !important;
border-radius: 16px !important;
font-weight: 800 !important;
font-size: 1.3rem !important;
text-transform: uppercase !important;
letter-spacing: 1px !important;
cursor: pointer !important;
box-shadow: var(--shadow-glow), 0 8px 30px var(--shadow-medium) !important;
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
display: inline-block !important;
width: 100% !important;
text-align: center !important;
">
π Try Live Demo
</button>
</a>
""")
with gr.Column():
gr.HTML("""
<a href="https://www.linkedin.com/in/shafaq-mandha-a0b2a4280/" target="_blank" style="text-decoration: none;">
<button class="demo-button" style="
background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 50%, var(--emerald-green) 100%) !important;
color: #ffffff !important;
border: 3px solid var(--neon-green) !important;
padding: 20px 40px !important;
border-radius: 16px !important;
font-weight: 800 !important;
font-size: 1.3rem !important;
text-transform: uppercase !important;
letter-spacing: 1px !important;
cursor: pointer !important;
box-shadow: var(--shadow-glow), 0 8px 30px var(--shadow-medium) !important;
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
display: inline-block !important;
width: 100% !important;
text-align: center !important;
">
π Connect With Me
</button>
</a>
""")
# Footer with premium styling
gr.HTML("""
<div style="text-align: center; margin-top: 5rem; padding: 3rem; background: var(--bg-gradient); border-radius: 20px; border: 3px solid var(--accent-green); box-shadow: var(--shadow-glow), 0 15px 50px var(--shadow-medium);">
<p style="color: var(--primary-green); font-weight: 900; font-size: 2rem; margin-bottom: 1rem; text-shadow: 2px 2px 4px var(--shadow-light);">
πΎ Shafaq's AgriWeather Hub - Cultivating Tomorrow's Agriculture Today β¨
</p>
<p style="color: var(--text-muted); margin: 1.5rem 0; font-size: 1.1rem; font-weight: 600;">
Β© 2024 AgriWeather Hub. All rights reserved. | Made with β€οΈ for farmers worldwide
</p>
<div style="margin-top: 2rem; padding: 1.5rem; background: var(--bg-card); border-radius: 12px; border: 2px solid var(--mint-green);">
<span style="color: var(--primary-green); font-size: 1.2rem; font-weight: 700;">π Sustainable β’ π Data-Driven β’ π€ Community-Focused β’ π¬ Innovation-Led</span>
</div>
</div>
""")
if __name__ == "__main__":
demo.launch(
server_name="0.0.0.0",
server_port=7860,
share=True,
show_error=True
) |