Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,12 @@ import csv
|
|
| 7 |
from dotenv import load_dotenv
|
| 8 |
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Load environment variables from .env file
|
| 11 |
load_dotenv()
|
| 12 |
|
|
@@ -35,7 +41,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 +68,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 |
-
|
| 70 |
|
| 71 |
prompt_text = build_prompt(location, roof_size, electricity_bill, ghi, solar_cost_per_kw)
|
| 72 |
|
|
|
|
| 7 |
from dotenv import load_dotenv
|
| 8 |
|
| 9 |
|
| 10 |
+
import streamlit as st
|
| 11 |
+
import pandas as pd
|
| 12 |
+
import google.generativeai as genai
|
| 13 |
+
import os
|
| 14 |
+
from dotenv import load_dotenv
|
| 15 |
+
|
| 16 |
# Load environment variables from .env file
|
| 17 |
load_dotenv()
|
| 18 |
|
|
|
|
| 41 |
st.write("### Enter Your Details Below:")
|
| 42 |
|
| 43 |
with st.form("solar_form"):
|
| 44 |
+
state_options = df['State'].dropna().unique()
|
| 45 |
|
| 46 |
location = st.selectbox("Select your State", options=sorted(state_options))
|
| 47 |
roof_size = st.number_input("Enter your roof size (in sq meters)", min_value=1)
|
|
|
|
| 68 |
|
| 69 |
# Generate the solar project estimate via Gemini
|
| 70 |
if submitted and location and roof_size > 0 and electricity_bill >= 0:
|
| 71 |
+
state_data = df[df['State'].str.contains(location, case=False)].iloc[0]
|
| 72 |
|
| 73 |
if state_data is not None:
|
| 74 |
ghi = state_data['Avg_GHI (kWh/m²/day)']
|
| 75 |
+
Solar_Cost_per_kW (₹) = state_data['Solar_Cost_per_kW (₹)']
|
| 76 |
|
| 77 |
prompt_text = build_prompt(location, roof_size, electricity_bill, ghi, solar_cost_per_kw)
|
| 78 |
|