import streamlit as st # Define material categories and their properties materials = { "Metals": {"Mechanical": 8, "Chemical": 6, "Thermal": 9, "Electrical": 9, "Magnetic": 8, "Optical": 3}, "Non-metals": {"Mechanical": 4, "Chemical": 8, "Thermal": 4, "Electrical": 3, "Magnetic": 1, "Optical": 7}, "Metalloids": {"Mechanical": 6, "Chemical": 7, "Thermal": 6, "Electrical": 6, "Magnetic": 4, "Optical": 5}, "Ceramics": {"Mechanical": 7, "Chemical": 9, "Thermal": 7, "Electrical": 5, "Magnetic": 3, "Optical": 6}, "Polymers": {"Mechanical": 5, "Chemical": 6, "Thermal": 3, "Electrical": 4, "Magnetic": 2, "Optical": 5}, "Alloys": {"Mechanical": 9, "Chemical": 7, "Thermal": 8, "Electrical": 7, "Magnetic": 6, "Optical": 4}, } # App title st.title("Material Selection Tool") # Sidebar for filtering properties st.sidebar.header("Filter Properties") property_filters = {} for prop in ["Mechanical", "Chemical", "Thermal", "Electrical", "Magnetic", "Optical"]: property_filters[prop] = st.sidebar.slider(f"{prop} (1-10)", 1, 10, (1, 10)) # Display filtered materials st.header("Filtered Materials") filtered_materials = [] for material, properties in materials.items(): if all( property_filters[prop][0] <= value <= property_filters[prop][1] for prop, value in properties.items() ): filtered_materials.append(material) if filtered_materials: st.write("The materials matching your criteria are:") for material in filtered_materials: st.markdown(f"- **{material}**") else: st.write("No materials match your selected criteria. Please adjust the filters.") # Footer st.sidebar.markdown("---") st.sidebar.write("Developed by [Your Name]")