MLDeveloper commited on
Commit
1e066cd
·
verified ·
1 Parent(s): 54c70ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -12
app.py CHANGED
@@ -68,6 +68,7 @@ if submitted and location and roof_size > 0 and electricity_bill >= 0:
68
  solar_cost_per_kw = state_data['Solar_Cost_per_kW (₹)']
69
 
70
  prompt_text = build_prompt(location, roof_size, electricity_bill, ghi, solar_cost_per_kw)
 
71
  # Call Gemini API once for all the batch generation
72
  with st.spinner("Generating solar estimate with Gemini..."):
73
  response = model.generate_content(prompt_text)
@@ -78,20 +79,11 @@ if submitted and location and roof_size > 0 and electricity_bill >= 0:
78
  # Break down the response into structured points
79
  estimated_data = response.text.strip().split("\n")
80
 
81
- # Extract the values for solar system size, cost, savings, and payback period
82
- values = []
83
  for point in estimated_data:
84
  if "solar system size" in point.lower() or "total system cost" in point.lower() or "monthly savings" in point.lower() or "payback period" in point.lower():
85
- # Extract the values and append to the list
86
- values.append(point.strip())
87
-
88
- # Display the values in 4 lines as requested
89
- if len(values) == 4:
90
- st.write(f"1. {values[0]}")
91
- st.write(f"2. {values[1]}")
92
- st.write(f"3. {values[2]}")
93
- st.write(f"4. {values[3]}")
94
  else:
95
  st.error("Sorry, the location entered does not match any available data.")
96
  else:
97
- st.warning("Please fill out all fields to see your solar project estimate.")
 
68
  solar_cost_per_kw = state_data['Solar_Cost_per_kW (₹)']
69
 
70
  prompt_text = build_prompt(location, roof_size, electricity_bill, ghi, solar_cost_per_kw)
71
+
72
  # Call Gemini API once for all the batch generation
73
  with st.spinner("Generating solar estimate with Gemini..."):
74
  response = model.generate_content(prompt_text)
 
79
  # Break down the response into structured points
80
  estimated_data = response.text.strip().split("\n")
81
 
82
+ # Display only the required points: system size, cost, savings, and payback period
 
83
  for point in estimated_data:
84
  if "solar system size" in point.lower() or "total system cost" in point.lower() or "monthly savings" in point.lower() or "payback period" in point.lower():
85
+ st.write(f"{point.strip()}")
 
 
 
 
 
 
 
 
86
  else:
87
  st.error("Sorry, the location entered does not match any available data.")
88
  else:
89
+ st.warning("Please fill out all fields to see your solar project estimate.")