Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
import numpy as np
|
4 |
-
|
5 |
import openai
|
6 |
|
7 |
# Load the solar data CSV file
|
@@ -38,15 +38,24 @@ def estimate_cost_and_savings(system_size, state_data, electricity_bill):
|
|
38 |
return system_cost, savings_per_month, payback_period
|
39 |
|
40 |
# Streamlit UI
|
|
|
41 |
st.title("AI-based Solar Project Estimation Tool")
|
42 |
|
43 |
-
#
|
44 |
-
st.
|
45 |
-
location = st.sidebar.text_input("Enter your city or state", "")
|
46 |
-
roof_size = st.sidebar.number_input("Enter your roof size (in sq meters)", min_value=1)
|
47 |
-
electricity_bill = st.sidebar.number_input("Enter your monthly electricity bill (₹)", min_value=0)
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
# Fetch state data from the dataset
|
51 |
state_data = get_state_data(location)
|
52 |
if state_data is not None:
|
@@ -69,9 +78,9 @@ if location and roof_size > 0 and electricity_bill >= 0:
|
|
69 |
|
70 |
# Plot savings and payback period
|
71 |
fig, ax = plt.subplots()
|
72 |
-
ax.bar(['Total System Cost', 'Monthly Savings', 'Payback Period'],
|
73 |
[system_cost, savings_per_month, payback_period*12], color=['blue', 'green', 'orange'])
|
74 |
-
ax.set_ylabel("Amount (₹) / Time (
|
75 |
ax.set_title("Solar System Estimation Breakdown")
|
76 |
st.pyplot(fig)
|
77 |
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
import numpy as np
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
import openai
|
6 |
|
7 |
# Load the solar data CSV file
|
|
|
38 |
return system_cost, savings_per_month, payback_period
|
39 |
|
40 |
# Streamlit UI
|
41 |
+
st.set_page_config(page_title="AI-based Solar Project Estimation Tool", layout="centered")
|
42 |
st.title("AI-based Solar Project Estimation Tool")
|
43 |
|
44 |
+
# Center all input widgets
|
45 |
+
st.write("### Enter Your Details Below:")
|
|
|
|
|
|
|
46 |
|
47 |
+
with st.form("solar_form"):
|
48 |
+
# Get the list of unique states from the dataset
|
49 |
+
state_options = df['State'].dropna().unique()
|
50 |
+
|
51 |
+
# Input widgets
|
52 |
+
location = st.selectbox("Select your State", options=sorted(state_options))
|
53 |
+
roof_size = st.number_input("Enter your roof size (in sq meters)", min_value=1)
|
54 |
+
electricity_bill = st.number_input("Enter your monthly electricity bill (₹)", min_value=0)
|
55 |
+
|
56 |
+
submitted = st.form_submit_button("Get Estimate")
|
57 |
+
|
58 |
+
if submitted and location and roof_size > 0 and electricity_bill >= 0:
|
59 |
# Fetch state data from the dataset
|
60 |
state_data = get_state_data(location)
|
61 |
if state_data is not None:
|
|
|
78 |
|
79 |
# Plot savings and payback period
|
80 |
fig, ax = plt.subplots()
|
81 |
+
ax.bar(['Total System Cost', 'Monthly Savings', 'Payback Period (months)'],
|
82 |
[system_cost, savings_per_month, payback_period*12], color=['blue', 'green', 'orange'])
|
83 |
+
ax.set_ylabel("Amount (₹) / Time (Months)")
|
84 |
ax.set_title("Solar System Estimation Breakdown")
|
85 |
st.pyplot(fig)
|
86 |
|