Spaces:
Sleeping
Sleeping
| import json | |
| import streamlit as st | |
| def load_slider_data(): | |
| """Load slider data from a JSON file and cache it for performance.""" | |
| with open("data/cost_sliders.json") as f: | |
| return json.load(f) | |
| def render_resource_input(name_clean, r, tooltip=None): | |
| if tooltip: | |
| st.markdown( | |
| f"""<span title="{tooltip}" style="font-weight: 500;">{name_clean} <sup style="color:#999;">ℹ️</sup></span>""", | |
| unsafe_allow_html=True | |
| ) | |
| else: | |
| st.markdown(f"**{name_clean}**") | |
| cap = st.number_input( | |
| label="", # Label shown above | |
| min_value=0.0, | |
| value=float(st.session_state.resource_caps.get(r, 0.0)), | |
| format="%.2f", | |
| key=f"cap_{r}" | |
| ) | |
| st.session_state.resource_caps[r] = cap | |