Spaces:
Sleeping
Sleeping
File size: 1,555 Bytes
e2a6440 ef77706 0ac596b 3d5da05 8e1eefd 3d5da05 ef77706 0ac596b e2a6440 0ac596b 294a2b3 ef77706 0ac596b ef77706 0ac596b a750ced 0ac596b a750ced 0ac596b a750ced 0ac596b 3d5da05 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
import os
import streamlit as st
import pandas as pd
import faiss
import numpy as np
from groq import Groq
from data_fetcher import fetch_nrel_data
# Fetch data from NREL API
data = get_hydrogen_data()
if data is None:
print("⚠️ Using backup dataset...")
data = [
{"station": "Example Station 1", "location": "California", "status": "Open"},
{"station": "Example Station 2", "location": "Texas", "status": "Planned"}
]
# Print the first station as a check
print("🚀 Hydrogen Station Data Sample:", data[0] if data else "No data available.")
# Import custom modules
from data_fetcher import get_hydrogen_data
from visuals import plot_hydrogen_capacity
# ✅ Load environment variables (API Keys)
NREL_API_KEY = os.getenv("NREL_API_KEY")
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
# ✅ Ensure API keys are set
if not NREL_API_KEY:
st.error("❌ ERROR: NREL API Key is missing! Please set it in environment variables.")
st.stop()
if not GROQ_API_KEY:
st.error("❌ ERROR: Groq API Key is missing! Please set it in environment variables.")
st.stop()
# ✅ Fetch real-time hydrogen data
hydrogen_data = get_hydrogen_data()
# ✅ Display UI
st.set_page_config(page_title="HydroGen-AI", layout="wide")
st.title("🔬 HydroGen-AI: Green Hydrogen Techno-Economic Analyzer")
if hydrogen_data is not None:
st.sidebar.subheader("📡 Real-time Hydrogen Data (NREL API)")
st.sidebar.write(hydrogen_data.head(5))
else:
st.sidebar.warning("⚠️ No hydrogen data available from NREL API.")
|