Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -82,7 +82,7 @@ def main():
|
|
| 82 |
|
| 83 |
st.write("### Total Estimated Monthly Units Consumed:", f"{total_units:.2f} kWh")
|
| 84 |
|
| 85 |
-
#
|
| 86 |
if st.button("Calculate Bill"):
|
| 87 |
if 'tariff_data' in st.session_state and st.session_state['tariff_data']:
|
| 88 |
bill = calculate_bill(total_units, st.session_state['tariff_data'])
|
|
@@ -91,7 +91,7 @@ def main():
|
|
| 91 |
else:
|
| 92 |
st.error("Could not calculate the bill. Please check the tariff data.")
|
| 93 |
else:
|
| 94 |
-
st.error("Please fetch the tariff rates first.")
|
| 95 |
|
| 96 |
if __name__ == "__main__":
|
| 97 |
# Initialize session state to store tariff data
|
|
|
|
| 82 |
|
| 83 |
st.write("### Total Estimated Monthly Units Consumed:", f"{total_units:.2f} kWh")
|
| 84 |
|
| 85 |
+
# Ensure tariff data is fetched before bill calculation
|
| 86 |
if st.button("Calculate Bill"):
|
| 87 |
if 'tariff_data' in st.session_state and st.session_state['tariff_data']:
|
| 88 |
bill = calculate_bill(total_units, st.session_state['tariff_data'])
|
|
|
|
| 91 |
else:
|
| 92 |
st.error("Could not calculate the bill. Please check the tariff data.")
|
| 93 |
else:
|
| 94 |
+
st.error("Please fetch the tariff rates first using the 'Fetch Tariff Rates' button.")
|
| 95 |
|
| 96 |
if __name__ == "__main__":
|
| 97 |
# Initialize session state to store tariff data
|