Update app.py
Browse files5 unmodified lines678910111213141557 unmodified lines7374757677787980818213 unmodified lines969798991001011025 unmodified linesimport csvfrom dotenv import load_dotenv# Load environment variables from .env fileload_dotenv()# Set page configuration firstst.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 lineswith st.spinner("Generating solar estimate with Gemini..."):response = model.generate_content(prompt_text)# Display structured output with only the requested pointsst.subheader("Solar Project Estimate")# Break down the response into structured points and extract only the numeric valuesestimated_data = response.text.strip().split("\n")# Initialize values for each field13 unmodified lineselif "payback period" in point.lower():payback_period = point.split(":")[1].strip()# Display the values without any additional explanationif 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}")5 unmodified lines67891011121314151657 unmodified lines7475767778798081828384858613 unmodified lines1001011021031041051065 unmodified linesimport csvfrom dotenv import load_dotenv# Load environment variables from .env fileload_dotenv()# 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 lineswith st.spinner("Generating solar estimate with Gemini..."):response = model.generate_content(prompt_text)# Debug: Print the raw response to see the structurest.write("Raw Response:", response.text)# Display structured output with only the requested pointsst.subheader("Solar Project Estimate")# Break down the response into structured pointsestimated_data = response.text.strip().split("\n")# Initialize values for each field13 unmodified lineselif "payback period" in point.lower():payback_period = point.split(":")[1].strip()# Ensure that we only display numeric values for the fieldsif 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