Update app.py
Browse files67 unmodified lines686970717273744 unmodified lines798081818282838485868788899091929385868788978967 unmodified lines solar_cost_per_kw = state_data['Solar_Cost_per_kW (₹)'] prompt_text = build_prompt(location, roof_size, electricity_bill, ghi, solar_cost_per_kw) # Call Gemini API once for all the batch generation with st.spinner("Generating solar estimate with Gemini..."): response = model.generate_content(prompt_text)4 unmodified lines # Break down the response into structured points estimated_data = response.text.strip().split("\n") # Extract the values for solar system size, cost, savings, and payback period values = [] # Display only the required points: system size, cost, savings, and payback period for point in estimated_data: 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(): # Extract the values and append to the list values.append(point.strip()) # Display the values in 4 lines as requested if len(values) == 4: st.write(f"1. {values[0]}") st.write(f"2. {values[1]}") st.write(f"3. {values[2]}") st.write(f"4. {values[3]}") st.write(f"{point.strip()}") else: st.error("Sorry, the location entered does not match any available data.")else: st.warning("Please fill out all fields to see your solar project estimate.") st.warning("Please fill out all fields to see your solar project estimate.")app.py+4-12