Update app.py
Browse files
app.py
CHANGED
|
@@ -35,7 +35,7 @@ st.title("AI-based Solar Project Estimation Tool")
|
|
| 35 |
st.write("### Enter Your Details Below:")
|
| 36 |
|
| 37 |
with st.form("solar_form"):
|
| 38 |
-
state_options = df['
|
| 39 |
|
| 40 |
location = st.selectbox("Select your State", options=sorted(state_options))
|
| 41 |
roof_size = st.number_input("Enter your roof size (in sq meters)", min_value=1)
|
|
@@ -62,11 +62,11 @@ def build_prompt(location, roof_size, electricity_bill, ghi, solar_cost_per_kw):
|
|
| 62 |
|
| 63 |
# Generate the solar project estimate via Gemini
|
| 64 |
if submitted and location and roof_size > 0 and electricity_bill >= 0:
|
| 65 |
-
state_data = df[df['
|
| 66 |
|
| 67 |
if state_data is not None:
|
| 68 |
ghi = state_data['Avg_GHI (kWh/m²/day)']
|
| 69 |
-
solar_cost_per_kw = state_data['
|
| 70 |
|
| 71 |
prompt_text = build_prompt(location, roof_size, electricity_bill, ghi, solar_cost_per_kw)
|
| 72 |
|
|
@@ -97,5 +97,3 @@ if submitted and location and roof_size > 0 and electricity_bill >= 0:
|
|
| 97 |
st.error("Sorry, the location entered does not match any available data.")
|
| 98 |
else:
|
| 99 |
st.warning("Please fill out all fields to see your solar project estimate.")
|
| 100 |
-
|
| 101 |
-
|
|
|
|
| 35 |
st.write("### Enter Your Details Below:")
|
| 36 |
|
| 37 |
with st.form("solar_form"):
|
| 38 |
+
state_options = df['states'].dropna().unique() # Ensure using the correct column name 'states'
|
| 39 |
|
| 40 |
location = st.selectbox("Select your State", options=sorted(state_options))
|
| 41 |
roof_size = st.number_input("Enter your roof size (in sq meters)", min_value=1)
|
|
|
|
| 62 |
|
| 63 |
# Generate the solar project estimate via Gemini
|
| 64 |
if submitted and location and roof_size > 0 and electricity_bill >= 0:
|
| 65 |
+
state_data = df[df['states'].str.contains(location, case=False)].iloc[0]
|
| 66 |
|
| 67 |
if state_data is not None:
|
| 68 |
ghi = state_data['Avg_GHI (kWh/m²/day)']
|
| 69 |
+
solar_cost_per_kw = state_data['Solar_Cost_per_kW (₹)'] # Use the correct column name here
|
| 70 |
|
| 71 |
prompt_text = build_prompt(location, roof_size, electricity_bill, ghi, solar_cost_per_kw)
|
| 72 |
|
|
|
|
| 97 |
st.error("Sorry, the location entered does not match any available data.")
|
| 98 |
else:
|
| 99 |
st.warning("Please fill out all fields to see your solar project estimate.")
|
|
|
|
|
|