Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import plotly.express as px
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import requests
|
| 5 |
+
|
| 6 |
+
# --- Page Config ---
|
| 7 |
+
st.set_page_config(page_title="ARMS Dashboard", page_icon="π", layout="wide")
|
| 8 |
+
|
| 9 |
+
# --- Sidebar Navigation ---
|
| 10 |
+
st.sidebar.title("π ARMS Navigation")
|
| 11 |
+
section = st.sidebar.radio("Go to:", ["π Home", "π Dashboard", "π Analytics", "π°οΈ NASA Feed"])
|
| 12 |
+
|
| 13 |
+
# --- Home Section ---
|
| 14 |
+
if section == "π Home":
|
| 15 |
+
st.title("π ARMS - Astronaut Resource Management System")
|
| 16 |
+
st.markdown("""
|
| 17 |
+
Welcome to the **ARMS Mission Dashboard** β your mission control hub for astronaut monitoring, analytics,
|
| 18 |
+
and space resource optimization.
|
| 19 |
+
|
| 20 |
+
πΉ Built with Streamlit
|
| 21 |
+
πΉ Powered by Hugging Face Spaces
|
| 22 |
+
πΉ Inspired by NASA data and futuristic analytics
|
| 23 |
+
""")
|
| 24 |
+
st.image("https://www.nasa.gov/sites/default/files/thumbnails/image/iss069e027047_lrg.jpg", use_container_width=True)
|
| 25 |
+
|
| 26 |
+
# --- Dashboard Section ---
|
| 27 |
+
elif section == "π Dashboard":
|
| 28 |
+
st.title("π Mission Health Dashboard")
|
| 29 |
+
|
| 30 |
+
# Sample Data
|
| 31 |
+
data = pd.DataFrame({
|
| 32 |
+
"Astronaut": ["Alice", "Bob", "Charlie", "Diana"],
|
| 33 |
+
"Heart Rate": [72, 85, 79, 90],
|
| 34 |
+
"Oxygen Level": [98, 96, 99, 97]
|
| 35 |
+
})
|
| 36 |
+
|
| 37 |
+
st.subheader("π©βπ Crew Vital Signs")
|
| 38 |
+
st.dataframe(data)
|
| 39 |
+
|
| 40 |
+
# Bar Chart
|
| 41 |
+
fig = px.bar(data, x="Astronaut", y="Heart Rate", color="Astronaut", title="Astronaut Heart Rates")
|
| 42 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 43 |
+
|
| 44 |
+
# --- Analytics Section ---
|
| 45 |
+
elif section == "π Analytics":
|
| 46 |
+
st.title("π Mission Analytics")
|
| 47 |
+
st.markdown("Analyze mission progress and performance metrics below:")
|
| 48 |
+
|
| 49 |
+
analytics_data = pd.DataFrame({
|
| 50 |
+
"Metric": ["Fuel Efficiency", "Resource Utilization", "Mission Success"],
|
| 51 |
+
"Value": [87, 92, 95]
|
| 52 |
+
})
|
| 53 |
+
|
| 54 |
+
fig = px.pie(analytics_data, names="Metric", values="Value", title="Mission Analytics Overview")
|
| 55 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 56 |
+
|
| 57 |
+
st.metric("Fuel Efficiency", "87%", "+2%")
|
| 58 |
+
st.metric("Resource Utilization", "92%", "+4%")
|
| 59 |
+
|
| 60 |
+
# --- NASA Feed Section ---
|
| 61 |
+
elif section == "π°οΈ NASA Feed":
|
| 62 |
+
st.title("π°οΈ NASA Daily Image Feed")
|
| 63 |
+
|
| 64 |
+
try:
|
| 65 |
+
response = requests.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY").json()
|
| 66 |
+
st.image(response["url"], caption=response["title"], use_container_width=True)
|
| 67 |
+
st.write(response["explanation"])
|
| 68 |
+
except Exception as e:
|
| 69 |
+
st.error("Failed to load NASA feed. Please try again later.")
|