Update app.py
Browse files5 unmodified lines6789101112121314151657 unmodified lines747576777879808182798384858613 unmodified lines100101102991031041051065 unmodified linesimport csvfrom dotenv import load_dotenv
# Load environment variables from .env fileload_dotenv()
# Set page configuration first# Set page configurationst.set_page_config(page_title="AI-based Solar Project Estimation Tool", layout="centered")
# Initialize Gemini with the API key loaded from the .env file57 unmodified lines with st.spinner("Generating solar estimate with Gemini..."): response = model.generate_content(prompt_text) # Debug: Print the raw response to see the structure st.write("Raw Response:", response.text) # Display structured output with only the requested points st.subheader("Solar Project Estimate") # Break down the response into structured points and extract only the numeric values # Break down the response into structured points estimated_data = response.text.strip().split("\n") # Initialize values for each field13 unmodified lines elif "payback period" in point.lower(): payback_period = point.split(":")[1].strip()
# Display the values without any additional explanation # Ensure that we only display numeric values for the fields if system_size and total_cost and monthly_savings and payback_period: st.write(f"1. Estimated solar system size in kW: {system_size}") st.write(f"2. Total system cost in ₹: {total_cost}")app.py+7-3