Spaces:
Sleeping
Sleeping
| 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 | |
| ) |