Spaces:
Build error
Build error
Upload 2 files
Browse files- requirements (1).txt +3 -0
- utils.py +14 -0
requirements (1).txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
groq
|
| 3 |
+
requests
|
utils.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
def fetch_tariff_data():
|
| 4 |
+
"""Fetch tariff data from the WAPDA website."""
|
| 5 |
+
# Example URL, replace with actual
|
| 6 |
+
url = "https://example-wapda-tariff.com/api"
|
| 7 |
+
response = requests.get(url)
|
| 8 |
+
return response.json()
|
| 9 |
+
|
| 10 |
+
def calculate_bill(load, usage_hours, tariff_data):
|
| 11 |
+
"""Calculate the monthly electricity bill."""
|
| 12 |
+
total_units = (load / 1000) * usage_hours * 30 # kWh
|
| 13 |
+
rate = tariff_data.get("rate_per_unit", 0)
|
| 14 |
+
return round(total_units * rate, 2)
|