Update app.py
Browse files123456730 unmodified lines38394041424344454647484950515216 unmodified lines697071727374757677import streamlit as stimport pandas as pdimport numpy as np#import matplotlib.pyplot as pltimport openai# Load the solar data CSV file30 unmodified linesreturn system_cost, savings_per_month, payback_period# Streamlit UIst.title("AI-based Solar Project Estimation Tool")# User input formst.sidebar.header("Enter Your Details")location = st.sidebar.text_input("Enter your city or state", "")roof_size = st.sidebar.number_input("Enter your roof size (in sq meters)", min_value=1)electricity_bill = st.sidebar.number_input("Enter your monthly electricity bill (₹)", min_value=0)if location and roof_size > 0 and electricity_bill >= 0:# Fetch state data from the datasetstate_data = get_state_data(location)if state_data is not None:16 unmodified lines# Plot savings and payback periodfig, ax = plt.subplots()ax.bar(['Total System Cost', 'Monthly Savings', 'Payback Period'],[system_cost, savings_per_month, payback_period*12], color=['blue', 'green', 'orange'])ax.set_ylabel("Amount (₹) / Time (years)")ax.set_title("Solar System Estimation Breakdown")st.pyplot(fig)123456730 unmodified lines38394041424344454647484950515253545556575859606116 unmodified lines787980818283848586import streamlit as stimport pandas as pdimport numpy as npimport matplotlib.pyplot as pltimport openai# Load the solar data CSV file30 unmodified linesreturn system_cost, savings_per_month, payback_period# Streamlit UIst.set_page_config(page_title="AI-based Solar Project Estimation Tool", layout="centered")st.title("AI-based Solar Project Estimation Tool")# Center all input widgetsst.write("### Enter Your Details Below:")with st.form("solar_form"):# Get the list of unique states from the datasetstate_options = df['State'].dropna().unique()# Input widgetslocation = st.selectbox("Select your State", options=sorted(state_options))roof_size = st.number_input("Enter your roof size (in sq meters)", min_value=1)electricity_bill = st.number_input("Enter your monthly electricity bill (₹)", min_value=0)submitted = st.form_submit_button("Get Estimate")if submitted and location and roof_size > 0 and electricity_bill >= 0:# Fetch state data from the datasetstate_data = get_state_data(location)if state_data is not None:16 unmodified lines# Plot savings and payback periodfig, ax = plt.subplots()ax.bar(['Total System Cost', 'Monthly Savings', 'Payback Period (months)'],[system_cost, savings_per_month, payback_period*12], color=['blue', 'green', 'orange'])ax.set_ylabel("Amount (₹) / Time (Months)")ax.set_title("Solar System Estimation Breakdown")st.pyplot(fig)
app.py+18-9