CoderHassan commited on
Commit
d4f0702
·
verified ·
1 Parent(s): e0a5118

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  import streamlit as st
3
- from groq import Groq
4
  import requests
5
  from utils import calculate_bill
6
 
@@ -28,10 +28,10 @@ if "appliance_data" not in st.session_state:
28
  st.session_state.appliance_data = []
29
 
30
  # Groq Client Setup
31
- #client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
32
 
33
  # App Configuration
34
- st.title("Pakistani Electricity Bill Calculator")
35
  st.sidebar.header("Add Appliances")
36
  st.sidebar.write("Select appliances, quantity, and usage details to calculate electricity consumption.")
37
 
@@ -89,12 +89,14 @@ if st.button("Calculate Monthly Bill"):
89
 
90
  # Calculate total monthly energy consumption by multiplying by 30
91
  monthly_energy_kwh = total_energy_kwh * 30
 
 
92
 
93
  # Get the rate from tariff data or use a default rate if not found
94
  rate_per_unit = tariff_data.get("rate_per_unit", 25) # Default rate of 25 PKR/kWh
95
 
96
  # Correct Monthly Bill Calculation: Total Monthly Energy in kWh * Rate per kWh (Rate in PKR)
97
- monthly_bill = monthly_energy_kwh * rate_per_unit
98
 
99
  # Query AI Model (optional, if needed for insights)
100
  query = f"Calculate the monthly electricity bill for appliances with a total energy consumption of {monthly_energy_kwh:.2f} kWh per month."
 
1
  import os
2
  import streamlit as st
3
+ from groq import Gorq
4
  import requests
5
  from utils import calculate_bill
6
 
 
28
  st.session_state.appliance_data = []
29
 
30
  # Groq Client Setup
31
+ client = Groq("GROQ_API_KEY"))
32
 
33
  # App Configuration
34
+ st.title("EnergyGuru_PowerCalc: AI DRIVEN AL DRIVEN BILL & CARBON FOOTPRINT TRACKER")
35
  st.sidebar.header("Add Appliances")
36
  st.sidebar.write("Select appliances, quantity, and usage details to calculate electricity consumption.")
37
 
 
89
 
90
  # Calculate total monthly energy consumption by multiplying by 30
91
  monthly_energy_kwh = total_energy_kwh * 30
92
+ # total monthly energy in kwh = no. of units
93
+ monthly_energy_kwh = total_no_of_units
94
 
95
  # Get the rate from tariff data or use a default rate if not found
96
  rate_per_unit = tariff_data.get("rate_per_unit", 25) # Default rate of 25 PKR/kWh
97
 
98
  # Correct Monthly Bill Calculation: Total Monthly Energy in kWh * Rate per kWh (Rate in PKR)
99
+ monthly_bill = total_no_of_units * rate_per_unit
100
 
101
  # Query AI Model (optional, if needed for insights)
102
  query = f"Calculate the monthly electricity bill for appliances with a total energy consumption of {monthly_energy_kwh:.2f} kWh per month."