Spaces:
Running
Running
| # electricity_prices.py | |
| """ | |
| Simplified electricity price module for Hugging Face demo. | |
| We don't load CSVs or use HF_DATASET_TOKEN anymore. | |
| The real-time app takes electricity_rate directly from the user. | |
| This file only exists: | |
| - to provide a simple default ELECTRICITY_RATES dict (if needed) | |
| - to keep compatibility with older imports (get_electricity_rate) | |
| """ | |
| # Simple default average rates for reference / fallback | |
| ELECTRICITY_RATES = { | |
| "texas": 0.15, # average residential USD/kWh (example) | |
| "china": 0.08, | |
| "ethiopia": 0.01, | |
| } | |
| def get_electricity_rate(region: str, day=None) -> float: | |
| """ | |
| For the real-time demo, we don't actually use this in feature construction | |
| (we rely on user input). But some legacy code may still call it. | |
| We simply return a region-average from ELECTRICITY_RATES, | |
| without reading any CSV or using HF_DATASET_TOKEN. | |
| """ | |
| return ELECTRICITY_RATES.get(region, 0.10) | |