Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import pandas as pd
|
3 |
-
import random
|
4 |
-
import plotly.express as px
|
5 |
-
import time
|
6 |
-
|
7 |
-
st.set_page_config(page_title="π Astronaut Survival Dashboard", layout="wide")
|
8 |
-
|
9 |
-
st.title("π Astronaut Survival Monitor")
|
10 |
-
st.markdown("---")
|
11 |
-
|
12 |
-
# Simulating real-time data updates
|
13 |
-
def get_real_time_data():
|
14 |
-
return {
|
15 |
-
"Heart Rate (BPM)": random.randint(60, 120),
|
16 |
-
"Oxygen Saturation (%)": round(random.uniform(85, 100), 1),
|
17 |
-
"Blood Pressure (mmHg)": f"{random.randint(90, 120)}/{random.randint(60, 80)}",
|
18 |
-
"Respiratory Rate (BPM)": random.randint(12, 20),
|
19 |
-
"Hydration Level (%)": round(random.uniform(40, 100), 1),
|
20 |
-
"Battery Level (%)": random.randint(10, 100),
|
21 |
-
"Food Supply (Days)": random.randint(1, 10),
|
22 |
-
"Water Supply (Liters)": random.randint(1, 50),
|
23 |
-
}
|
24 |
-
|
25 |
-
# Survival Time Prediction
|
26 |
-
def predict_survival_time(data):
|
27 |
-
oxygen_factor = data["Oxygen Saturation (%)"] / 100
|
28 |
-
hydration_factor = data["Hydration Level (%)"] / 100
|
29 |
-
battery_factor = data["Battery Level (%)"] / 100
|
30 |
-
food_factor = data["Food Supply (Days)"] / 10
|
31 |
-
|
32 |
-
survival_hours = (oxygen_factor + hydration_factor + battery_factor + food_factor) * 10
|
33 |
-
return round(survival_hours, 2)
|
34 |
-
|
35 |
-
# Real-time simulation
|
36 |
-
data = get_real_time_data()
|
37 |
-
survival_time = predict_survival_time(data)
|
38 |
-
|
39 |
-
col1, col2 = st.columns(2)
|
40 |
-
col1.metric("β³ Predicted Survival Time", f"{survival_time} Hours", delta=round(random.uniform(-1, 1), 2))
|
41 |
-
|
42 |
-
st.markdown("---")
|
43 |
-
st.subheader("π Health & Resource Data")
|
44 |
-
|
45 |
-
# Creating DataFrame for visualization
|
46 |
-
df = pd.DataFrame([data]).melt(var_name="Metric", value_name="Value")
|
47 |
-
fig = px.bar(df, x="Value", y="Metric", orientation='h', text_auto=True, color="Metric")
|
48 |
-
st.plotly_chart(fig, use_container_width=True)
|
49 |
-
|
50 |
-
# Cylindrical Gauges for Oxygen and Water Levels
|
51 |
-
col3, col4 = st.columns(2)
|
52 |
-
fig_oxygen = px.bar_polar(r=[data["Oxygen Saturation (%)"]], theta=["Oxygen"], range_r=[0, 100], color_discrete_sequence=["blue"])
|
53 |
-
fig_water = px.bar_polar(r=[data["Water Supply (Liters)"]], theta=["Water"], range_r=[0, 50], color_discrete_sequence=["cyan"])
|
54 |
-
col3.plotly_chart(fig_oxygen, use_container_width=True)
|
55 |
-
col4.plotly_chart(fig_water, use_container_width=True)
|
56 |
-
|
57 |
-
# Buttons for emergency scenarios
|
58 |
-
st.markdown("---")
|
59 |
-
st.subheader("π¨ Emergency Actions")
|
60 |
-
if st.button("Activate Emergency Mode"):
|
61 |
-
st.error("π¨ Emergency Mode Activated! All non-essential systems shutting down.")
|
62 |
-
if st.button("Request Mission Control Support"):
|
63 |
-
st.warning("π‘ Sending SOS Signal to Mission Control...")
|
64 |
-
|
65 |
-
# Alerting system
|
66 |
-
if data["Oxygen Saturation (%)"] < 90 or data["Battery Level (%)"] < 20:
|
67 |
-
st.error("π¨ Critical Alert: Low Oxygen or Power Levels Detected! Immediate action required.")
|
68 |
-
|
69 |
-
st.success("β
All systems nominal") if data["Oxygen Saturation (%)"] >= 90 and data["Battery Level (%)"] >= 20 else None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|