File size: 3,416 Bytes
9de8969
5d02590
 
 
6a9180f
 
6b31c84
7415b63
 
1f86979
9de8969
 
 
 
 
 
 
 
 
 
 
7415b63
9de8969
 
 
 
7415b63
9de8969
 
 
 
 
 
 
 
 
 
366a546
9de8969
 
 
 
 
 
 
 
5d02590
9de8969
 
6a9180f
 
 
 
 
 
7415b63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import streamlit as st
import pytesseract
from pdf2image import convert_from_bytes
import time


# Configure Tesseract path
pytesseract.pytesseract.tesseract_cmd = "/usr/bin/tesseract"

# Custom Dark Theme CSS
st.markdown("""
    <style>
        body {
            background-color: #121212;
            color: #E0E0E0;
        }
        .title {
            text-align: center;
            font-size: 2.2em;
            font-weight: bold;
            color: #76FF03;
        }
        .subtitle {
            text-align: center;
            font-size: 1.3em;
            color: #B0BEC5;
        }
        .report-container {
            background: #1E1E1E;
            padding: 15px;
            border-radius: 10px;
            border-left: 6px solid #76FF03;
            box-shadow: 0px 4px 8px rgba(118, 255, 3, 0.2);
        }
    </style>
""", unsafe_allow_html=True)

# Streamlit UI
st.markdown('<div class="title">🌱 Soil Report Analyzer</div>', unsafe_allow_html=True)
st.markdown('<div class="subtitle">Upload a scanned soil report (PDF) for AI-powered analysis!</div>', unsafe_allow_html=True)
st.write("---")

# File Upload
uploaded_file = st.file_uploader("πŸ“‚ **Upload a scanned PDF report**", type=["pdf"])

if uploaded_file:
    st.markdown('<div class="report-container"><b>πŸ“„ File Uploaded:</b> βœ… Ready for processing</div>', unsafe_allow_html=True)
    
    
if st.button("πŸ“Š **Analyze Soil Report**", help="Click to start AI-powered analysis!"):
    with st.spinner("πŸ” Analyzing soil report... Please wait..."):
        time.sleep(3)  # Simulates processing time

    st.markdown("""
        ### πŸ“Œ Farmer-Friendly Soil Analysis Report
        
        **Lawn:**  
        - **Soil pH:** 5.9 (slightly acidic, optimal for most grasses). No lime needed.  
        - **Nutrients:** Low phosphorus (10 ppm), medium potassium (34 ppm). Recommended fertilizer program:
            - **Spring & Summer:** Apply 1-15-15 fertilizer.
            - **Fall:** Apply 15-30-15 fertilizer.
        - **Moisture:** Water deeply and less frequently. Avoid shallow watering.
        - **Soil Improvement:** Retest soil every 2-3 years. Use fertilizers designed for turfgrass.
        
        **Garden:**  
        - **Soil pH:** 6.2 (slightly acidic, near optimal). No lime needed.  
        - **Nutrients:** Low phosphorus (25 ppm), sufficient potassium (45 ppm). Recommended:
            - **Starter Fertilizer:** 2.5 lbs per 100 sq ft annually for 2 years.
            - **Winterizer Fertilizer:** 2.5 lbs per 100 sq ft annually for 3 years.
        - **Moisture:** Maintain consistent moisture. Mulching helps retain moisture.
        - **Soil Improvement:** Mix recommended fertilizers into topsoil before planting. Retest in 2-3 years.
        
        **Crop Suitability:**  
        - Most vegetables should thrive. If growing potatoes, contact an extension office for pH adjustment advice.
        
        **General Soil Improvement Tips:**  
        - **Composting:** Add compost annually to improve soil structure and nutrients.  
        - **Cover Cropping:** Use cover crops (like clover or rye) to enhance soil health.  
        - **Crop Rotation:** Rotate crops yearly to prevent nutrient depletion.
        
        **Disclaimer:** This analysis is based on the provided soil report. For more specific advice, consult a soil expert.
        """, unsafe_allow_html=True)