MLDeveloper commited on
Commit
1f53c6b
Β·
verified Β·
1 Parent(s): 4208ef9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -6,6 +6,14 @@ from dotenv import load_dotenv
6
  import plotly.graph_objects as go
7
 
8
 
 
 
 
 
 
 
 
 
9
  # Load environment variables from .env file
10
  load_dotenv()
11
 
@@ -114,7 +122,8 @@ if submitted and location:
114
  monthly_savings_rs = None
115
  total_system_cost = None
116
  payback_period_years = None
117
-
 
118
  for point in estimated_data:
119
  if ":" in point:
120
  try:
@@ -136,17 +145,20 @@ if submitted and location:
136
  except ValueError:
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(
@@ -170,4 +182,3 @@ if submitted and location:
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
-
 
6
  import plotly.graph_objects as go
7
 
8
 
9
+ import streamlit as st
10
+ import pandas as pd
11
+ import google.generativeai as genai
12
+ import os
13
+ from dotenv import load_dotenv
14
+ import plotly.graph_objects as go
15
+
16
+
17
  # Load environment variables from .env file
18
  load_dotenv()
19
 
 
122
  monthly_savings_rs = None
123
  total_system_cost = None
124
  payback_period_years = None
125
+ daily_output_kwh = None # Add this variable
126
+
127
  for point in estimated_data:
128
  if ":" in point:
129
  try:
 
145
  except ValueError:
146
  st.warning("There was an issue processing the response. Please try again.")
147
 
148
+ # Calculate Daily Output in kWh
149
+ if system_size_kw is not None and ghi is not None:
150
+ daily_output_kwh = system_size_kw * ghi # Estimate daily output in kWh
151
+
152
+ # Visual Summary - Grouped Bar Chart
153
  if system_size_kw is not None and total_system_cost is not None:
154
  st.subheader("πŸ“Š Visual Summary")
155
 
156
  # Grouped Bar chart for all the values
157
+ fig = go.Figure(data=[
158
  go.Bar(
159
  name="System Size (kW)",
160
  x=["Solar System Size", "Daily Output", "Total Cost", "Monthly Savings", "Payback Period"],
161
+ y=[system_size_kw, daily_output_kwh , total_system_cost, monthly_savings_rs, payback_period_years],
162
  marker_color='#636EFA'
163
  ),
164
  go.Bar(
 
182
  st.error("Sorry, the location entered does not match any available data.")
183
  else:
184
  st.warning("Please fill out all fields to see your solar project estimate.")