MLDeveloper commited on
Commit
0656e74
·
verified ·
1 Parent(s): 6ef9c40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -28
app.py CHANGED
@@ -70,32 +70,4 @@ if submitted and location and roof_size > 0 and electricity_bill >= 0:
70
  else:
71
  st.warning("Please fill out all fields to see your solar project estimate.")
72
 
73
- # Batch CSV Export
74
- st.markdown("### Export Solar Estimates")
75
- batch = st.number_input("How many estimates to generate?", min_value=1, max_value=100, value=5)
76
 
77
- if st.button("Generate Batch & Download CSV"):
78
- if location and roof_size > 0 and electricity_bill >= 0:
79
- csv_buffer = StringIO()
80
- writer = csv.writer(csv_buffer)
81
- writer.writerow(["Sequence_no", "Solar Estimate"])
82
-
83
- with st.spinner("Generating estimates..."):
84
- for i in range(1, batch + 1):
85
- state_data = df[df['State'].str.contains(location, case=False)].iloc[0]
86
- ghi = state_data['Avg_GHI (kWh/m²/day)']
87
- solar_cost_per_kw = state_data['Solar_Cost_per_kW (₹)']
88
- prompt_text = build_prompt(location, roof_size, electricity_bill, ghi, solar_cost_per_kw)
89
-
90
- # Generate the estimate using Gemini
91
- response = model.generate_content(prompt_text)
92
- writer.writerow([i, response.text.strip()])
93
-
94
- st.download_button(
95
- label="Download Solar Estimates CSV",
96
- data=csv_buffer.getvalue(),
97
- file_name="solar_estimates.csv",
98
- mime="text/csv"
99
- )
100
- else:
101
- st.warning("Please fill out all fields to generate batch estimates.")
 
70
  else:
71
  st.warning("Please fill out all fields to see your solar project estimate.")
72
 
 
 
 
73