Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ import plotly.graph_objects as go
|
|
| 10 |
load_dotenv()
|
| 11 |
|
| 12 |
# Set page configuration
|
| 13 |
-
st.set_page_config(page_title="☀️AI-
|
| 14 |
|
| 15 |
# Initialize Gemini with the API key
|
| 16 |
api_key = os.getenv("GOOGLE_API_KEY")
|
|
@@ -67,7 +67,7 @@ Payback period in years: <value>
|
|
| 67 |
return prompt
|
| 68 |
|
| 69 |
# UI - Form for user input
|
| 70 |
-
st.title("☀️ AI-
|
| 71 |
st.write("### Enter Your Details Below:")
|
| 72 |
|
| 73 |
with st.form("solar_form"):
|
|
@@ -137,45 +137,37 @@ if submitted and location:
|
|
| 137 |
st.warning("There was an issue processing the response. Please try again.")
|
| 138 |
|
| 139 |
# Show Graph if values are available
|
| 140 |
-
|
|
|
|
| 141 |
st.subheader("📊 Visual Summary")
|
| 142 |
-
|
| 143 |
-
#
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
)
|
| 158 |
-
|
| 159 |
-
#
|
| 160 |
-
fig.add_trace(go.Scatter(
|
| 161 |
-
x=[1, months],
|
| 162 |
-
y=[total_system_cost, total_system_cost],
|
| 163 |
-
mode='lines',
|
| 164 |
-
name='Total System Cost (₹)',
|
| 165 |
-
line=dict(color='red', dash='dash')
|
| 166 |
-
))
|
| 167 |
-
|
| 168 |
fig.update_layout(
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
yaxis_title="
|
| 172 |
-
|
| 173 |
-
template="plotly_white"
|
| 174 |
)
|
| 175 |
-
|
| 176 |
-
st.plotly_chart(fig, use_container_width=True, key="solar_graph")
|
| 177 |
|
| 178 |
else:
|
| 179 |
st.error("Sorry, the location entered does not match any available data.")
|
| 180 |
else:
|
| 181 |
-
st.
|
|
|
|
|
|
| 10 |
load_dotenv()
|
| 11 |
|
| 12 |
# Set page configuration
|
| 13 |
+
st.set_page_config(page_title="☀️AI-Based Solar Project Estimation Tool", layout="centered")
|
| 14 |
|
| 15 |
# Initialize Gemini with the API key
|
| 16 |
api_key = os.getenv("GOOGLE_API_KEY")
|
|
|
|
| 67 |
return prompt
|
| 68 |
|
| 69 |
# UI - Form for user input
|
| 70 |
+
st.title("☀️ AI-Based Solar Project Estimation Tool")
|
| 71 |
st.write("### Enter Your Details Below:")
|
| 72 |
|
| 73 |
with st.form("solar_form"):
|
|
|
|
| 137 |
st.warning("There was an issue processing the response. Please try again.")
|
| 138 |
|
| 139 |
# Show Graph if values are available
|
| 140 |
+
# Visual Summary - Grouped Bar Chart
|
| 141 |
+
if system_size_kw is not None and total_system_cost is not None:
|
| 142 |
st.subheader("📊 Visual Summary")
|
| 143 |
+
|
| 144 |
+
# Grouped Bar chart for all the values
|
| 145 |
+
fig = go.Figure(data=[
|
| 146 |
+
go.Bar(
|
| 147 |
+
name="System Size (kW)",
|
| 148 |
+
x=["Solar System Size", "Daily Output", "Total Cost", "Monthly Savings", "Payback Period"],
|
| 149 |
+
y=[system_size_kw, daily_output_kwh, total_system_cost, monthly_savings_rs, payback_period_years],
|
| 150 |
+
marker_color='#636EFA'
|
| 151 |
+
),
|
| 152 |
+
go.Bar(
|
| 153 |
+
name="Financials",
|
| 154 |
+
x=["Solar System Size", "Daily Output", "Total Cost", "Monthly Savings", "Payback Period"],
|
| 155 |
+
y=[0, 0, total_system_cost, monthly_savings_rs, payback_period_years],
|
| 156 |
+
marker_color='#00CC96'
|
| 157 |
+
)
|
| 158 |
+
])
|
| 159 |
+
|
| 160 |
+
# Update layout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
fig.update_layout(
|
| 162 |
+
barmode='group',
|
| 163 |
+
title="Comparison of Solar System Parameters",
|
| 164 |
+
yaxis_title="Values",
|
| 165 |
+
xaxis_title="Parameters"
|
|
|
|
| 166 |
)
|
| 167 |
+
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
| 168 |
|
| 169 |
else:
|
| 170 |
st.error("Sorry, the location entered does not match any available data.")
|
| 171 |
else:
|
| 172 |
+
st.warning("Please fill out all fields to see your solar project estimate.")
|
| 173 |
+
|