CoderHassan commited on
Commit
9c2b67c
·
verified ·
1 Parent(s): 614ff29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -22
app.py CHANGED
@@ -3,10 +3,6 @@ import requests
3
  import streamlit as st
4
  import pandas as pd
5
  from scraper import scrape_tariffs
6
- from groq import Groq
7
-
8
- # Initialize Groq client
9
- client = Groq(api_key=os.environ.get('GroqApi'))
10
 
11
  # Streamlit App: ⚡ EnergyGuru_PowerCalc: AI-Driven Bill & Carbon Footprint Tracker
12
  st.title("⚡ EnergyGuru_PowerCalc: AI-Driven Bill & Carbon Footprint Tracker")
@@ -118,25 +114,7 @@ if st.session_state["appliance_list"] and rate_per_kwh > 0:
118
  st.write(f"💵 **Estimated Electricity Bill**: **{bill_amount:.2f} PKR**")
119
  st.write(f"🌍 **Estimated Carbon Footprint**: **{carbon_footprint:.2f} kg CO2 per month**")
120
 
121
- # Generate Groq-based advice to reduce carbon footprint
122
- appliance_names = [appliance["appliance"] for appliance in st.session_state["appliance_list"]]
123
- appliance_list_str = ", ".join(appliance_names)
124
-
125
- chat_completion = client.chat.completions.create(
126
- messages=[{
127
- "role": "user",
128
- "content": (
129
- f"Provide exactly 3 to 4 short, one-line tips to reduce the carbon footprint caused "
130
- f"by the usage of the following appliances: {appliance_list_str}. The tips should be "
131
- f"practical and relevant to these appliances only."
132
- )
133
- }],
134
- model="llama3-8b-8192",
135
- )
136
 
137
- advice = chat_completion.choices[0].message.content
138
- st.subheader("💡 Tips to Reduce Carbon Footprint")
139
- st.write(advice)
140
  else:
141
  st.info("ℹ️ Add appliances to calculate the electricity bill and carbon footprint.")
142
 
 
3
  import streamlit as st
4
  import pandas as pd
5
  from scraper import scrape_tariffs
 
 
 
 
6
 
7
  # Streamlit App: ⚡ EnergyGuru_PowerCalc: AI-Driven Bill & Carbon Footprint Tracker
8
  st.title("⚡ EnergyGuru_PowerCalc: AI-Driven Bill & Carbon Footprint Tracker")
 
114
  st.write(f"💵 **Estimated Electricity Bill**: **{bill_amount:.2f} PKR**")
115
  st.write(f"🌍 **Estimated Carbon Footprint**: **{carbon_footprint:.2f} kg CO2 per month**")
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
 
 
 
118
  else:
119
  st.info("ℹ️ Add appliances to calculate the electricity bill and carbon footprint.")
120