Update app.py
Browse files
app.py
CHANGED
|
@@ -16,6 +16,7 @@ from datetime import datetime
|
|
| 16 |
from typing import Dict, Any, Tuple, List, Optional
|
| 17 |
import streamlit as st
|
| 18 |
from streamlit_folium import st_folium
|
|
|
|
| 19 |
|
| 20 |
# Visualization & PDF
|
| 21 |
import matplotlib.pyplot as plt
|
|
@@ -1890,21 +1891,74 @@ if "page" not in st.session_state:
|
|
| 1890 |
page = st.session_state["page"]
|
| 1891 |
|
| 1892 |
# Option menu top (main nav)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1893 |
selected = option_menu(
|
| 1894 |
None,
|
| 1895 |
-
|
| 1896 |
-
icons=[
|
|
|
|
|
|
|
|
|
|
| 1897 |
menu_icon="cast",
|
| 1898 |
-
default_index=
|
| 1899 |
orientation="horizontal",
|
| 1900 |
styles={
|
| 1901 |
-
"container": {"padding":"0px","background-color":"#0b0b0b"},
|
| 1902 |
-
"nav-link": {"font-size":"14px","color":"#cfcfcf"},
|
| 1903 |
-
"nav-link-selected": {"background-color":"#FF7A00","color":"white"},
|
| 1904 |
}
|
| 1905 |
)
|
|
|
|
|
|
|
| 1906 |
st.session_state["page"] = selected
|
| 1907 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1908 |
|
| 1909 |
# Display page content
|
| 1910 |
if page == "Home":
|
|
|
|
| 16 |
from typing import Dict, Any, Tuple, List, Optional
|
| 17 |
import streamlit as st
|
| 18 |
from streamlit_folium import st_folium
|
| 19 |
+
from streamlit_option_menu import option_menu
|
| 20 |
|
| 21 |
# Visualization & PDF
|
| 22 |
import matplotlib.pyplot as plt
|
|
|
|
| 1891 |
page = st.session_state["page"]
|
| 1892 |
|
| 1893 |
# Option menu top (main nav)
|
| 1894 |
+
# ===============================
|
| 1895 |
+
# Navigation (Option Menu)
|
| 1896 |
+
# ===============================
|
| 1897 |
+
from streamlit_option_menu import option_menu
|
| 1898 |
+
|
| 1899 |
+
# Define all pages
|
| 1900 |
+
PAGES = ["Home", "Soil recognizer", "Classifier", "GSD", "OCR", "Locator", "RAG", "Reports"]
|
| 1901 |
+
|
| 1902 |
+
# Set default page if not defined yet
|
| 1903 |
+
if "page" not in st.session_state:
|
| 1904 |
+
st.session_state["page"] = "Home"
|
| 1905 |
+
|
| 1906 |
+
# Build horizontal option menu
|
| 1907 |
selected = option_menu(
|
| 1908 |
None,
|
| 1909 |
+
PAGES,
|
| 1910 |
+
icons=[
|
| 1911 |
+
"house", "chart", "journal-code", "bar-chart", "camera",
|
| 1912 |
+
"geo-alt", "robot", "file-earmark-text"
|
| 1913 |
+
],
|
| 1914 |
menu_icon="cast",
|
| 1915 |
+
default_index=PAGES.index(st.session_state["page"]) if st.session_state["page"] in PAGES else 0,
|
| 1916 |
orientation="horizontal",
|
| 1917 |
styles={
|
| 1918 |
+
"container": {"padding": "0px", "background-color": "#0b0b0b"},
|
| 1919 |
+
"nav-link": {"font-size": "14px", "color": "#cfcfcf"},
|
| 1920 |
+
"nav-link-selected": {"background-color": "#FF7A00", "color": "white"},
|
| 1921 |
}
|
| 1922 |
)
|
| 1923 |
+
|
| 1924 |
+
# Save selection into session_state
|
| 1925 |
st.session_state["page"] = selected
|
| 1926 |
+
|
| 1927 |
+
# ===============================
|
| 1928 |
+
# Page Routing
|
| 1929 |
+
# ===============================
|
| 1930 |
+
if selected == "Home":
|
| 1931 |
+
st.title("π Welcome to GeoMate")
|
| 1932 |
+
st.write("Your geotechnical AI copilot.")
|
| 1933 |
+
|
| 1934 |
+
elif selected == "Soil recognizer":
|
| 1935 |
+
st.title("π Soil Recognizer")
|
| 1936 |
+
st.write("Upload soil images for classification.")
|
| 1937 |
+
|
| 1938 |
+
elif selected == "Classifier":
|
| 1939 |
+
st.title("π Soil Classifier")
|
| 1940 |
+
st.write("Enter lab/field parameters for classification.")
|
| 1941 |
+
|
| 1942 |
+
elif selected == "GSD":
|
| 1943 |
+
st.title("π Grain Size Distribution")
|
| 1944 |
+
st.write("Analyze particle size distribution.")
|
| 1945 |
+
|
| 1946 |
+
elif selected == "OCR":
|
| 1947 |
+
st.title("π· OCR Extractor")
|
| 1948 |
+
st.write("Upload lab sheets for automatic text extraction.")
|
| 1949 |
+
|
| 1950 |
+
elif selected == "Locator":
|
| 1951 |
+
st.title("π Locator Tool")
|
| 1952 |
+
st.write("Draw ROI on map and compute Earth Engine summaries.")
|
| 1953 |
+
|
| 1954 |
+
elif selected == "RAG":
|
| 1955 |
+
st.title("π€ Knowledge Assistant")
|
| 1956 |
+
st.write("Query soil and geotechnical references with AI.")
|
| 1957 |
+
|
| 1958 |
+
elif selected == "Reports":
|
| 1959 |
+
st.title("π Reports")
|
| 1960 |
+
st.write("Generate classification and full reports.")
|
| 1961 |
+
|
| 1962 |
|
| 1963 |
# Display page content
|
| 1964 |
if page == "Home":
|