Spaces:
Sleeping
Sleeping
import streamlit as st | |
# Home Page Content | |
def home_page(): | |
st.write(""" | |
Welcome to The Nomad Electrician! We specialize in providing sustainable electrical solutions | |
while embracing a nomadic lifestyle. Our mission is to promote renewable energy and | |
contribute to a greener future through our expertise in electrical work. | |
""") | |
st.write("### Services Offered:") | |
st.write("- Solar Energy Installations") | |
st.write("- Eco-friendly Electrical Solutions") | |
st.write("- Electrical Safety Inspections") | |
st.write("- Consultations for Sustainable Living") | |
# Project Gallery Content | |
def project_gallery(): | |
st.write("Check out some of our completed projects:") | |
projects = { | |
"Solar Panel Installation": "solar_image.jpg", # Ensure this path is correct | |
"Eco-friendly Retreat": "retreat_image.jpg", # Ensure this path is correct | |
"Community Center Upgrade": "community_center_image.jpg" # Ensure this path is correct | |
} | |
# Create a grid layout for the gallery | |
cols = st.columns(3) # Adjust the number of columns as needed | |
for idx, (project, image_path) in enumerate(projects.items()): | |
with cols[idx % 3]: # Cycle through columns | |
st.subheader(project) | |
try: | |
st.image(image_path, caption=project, use_container_width=True) | |
except Exception as e: | |
st.error(f"Error loading image: {e}") | |
st.write("Description of the project and its impact.") | |
# Educational Resources Content | |
def educational_resources(): | |
st.write("Learn more about electrical skills, safety tips, and renewable energy:") | |
resources = { | |
"Electrical Safety Tips": "https://example.com/safety-tips", | |
"Introduction to Solar Energy": "https://example.com/solar-energy", | |
"DIY Electrical Projects": "https://example.com/diy-projects" | |
} | |
for title, link in resources.items(): | |
st.write(f"[{title}]({link})") | |
# Travel Log Content | |
def travel_log(): | |
st.write("Follow our journey and insights from various locations:") | |
locations = { | |
"Kenya": (36.82, -1.29), # Example coordinates | |
"South Africa": (26.20, 28.04), | |
"India": (20.59, 78.96) | |
} | |
# Create a DataFrame for the map | |
import pandas as pd | |
df = pd.DataFrame({ | |
'lat': [loc[0] for loc in locations.values()], | |
'lon': [loc[1] for loc in locations.values()] | |
}) | |
st.map(df) | |
for location, coords in locations.items(): | |
st.subheader(location) | |
st.write(f"Stories and insights from {location}.") | |
# Tools and Technology Reviews Content | |
def tools_reviews(): | |
st.write("Check out our reviews of the best tools and apps for electricians:") | |
tools = { | |
"Multimeter XYZ": 4.5, | |
"Solar Panel Optimizer": 4.8, | |
"Electrical Design Software": 4.2 | |
} | |
for tool, rating in tools.items(): | |
st.write(f"**{tool}**: Rating {rating}/5") | |
st.write("User comments and detailed review.") | |
# Contact Form Content | |
def contact_form(): | |
st.write("Get in touch for inquiries or collaborations:") | |
with st.form("contact_form"): | |
name = st.text_input("Name") | |
email = st.text_input("Email") | |
message = st.text_area("Message") | |
submitted = st.form_submit_button("Submit") | |
if submitted: | |
st.write("Thank you for your message! We will get back to you soon.") | |
# Main App with Tabs and Sidebar | |
def main(): | |
st.title("The Nomad Electrician") | |
# Sidebar | |
st.sidebar.title("About and Help") | |
st.sidebar.subheader("About Us") | |
st.sidebar.write(""" | |
The Nomad Electrician is dedicated to providing high-quality, sustainable electrical solutions. | |
Our team of experienced electricians is committed to promoting renewable energy and contributing to a greener future. | |
""") | |
st.sidebar.subheader("Help") | |
st.sidebar.write(""" | |
If you have any questions or need assistance, please feel free to reach out to us. | |
We are here to help with your electrical needs and provide expert advice on sustainable solutions. | |
""") | |
# Tabs | |
tabs = st.tabs(["Home", "Project Gallery", "Educational Resources", "Travel Log", "Tools Reviews", "Contact"]) | |
with tabs[0]: | |
home_page() | |
with tabs[1]: | |
project_gallery() | |
with tabs[2]: | |
educational_resources() | |
with tabs[3]: | |
travel_log() | |
with tabs[4]: | |
tools_reviews() | |
with tabs[5]: | |
contact_form() | |
if __name__ == "__main__": | |
main() | |