Download app.py from MuhammadHananKhan123/Material-Selector-Design: direct link, hf CLI and curl.
- Browser
- Download file 2.17 kB
-
https://huggingface.co/spaces/MuhammadHananKhan123/Material-Selector-Design/resolve/main/app.py
- Command line
-
hf download hf://spaces/MuhammadHananKhan123/Material-Selector-Design/app.py
-
curl -L -o app.py https://huggingface.co/spaces/MuhammadHananKhan123/Material-Selector-Design/resolve/main/app.py
2.17 kB
| import streamlit as st | |
| # Define the properties and their details | |
| properties = { | |
| "Mechanical": ["Tensile Strength", "Hardness", "Elasticity", "Ductility"], | |
| "Chemical": ["Corrosion Resistance", "Reactivity", "pH Resistance"], | |
| "Thermal": ["Thermal Conductivity", "Thermal Expansion", "Melting Point"], | |
| "Electrical": ["Electrical Conductivity", "Resistivity", "Dielectric Strength"], | |
| "Magnetic": ["Magnetic Permeability", "Coercivity", "Magnetic Retentivity"], | |
| "Optical": ["Refractive Index", "Transparency", "Color"], | |
| } | |
| # Define the materials and their details | |
| materials = { | |
| "Metals": ["Iron", "Copper", "Aluminum", "Gold", "Silver"], | |
| "Non-metals": ["Sulfur", "Carbon", "Oxygen"], | |
| "Metalloids": ["Boron", "Silicon", "Arsenic"], | |
| "Ceramics": ["Porcelain", "Glass", "Zirconia"], | |
| "Polymers": ["Polyethylene", "Nylon", "Polycarbonate"], | |
| "Alloys": ["Steel", "Brass", "Bronze"], | |
| } | |
| # Streamlit app layout | |
| st.title("Material Selection Tool") | |
| st.sidebar.header("Select Properties and Materials") | |
| # Allow user to select properties | |
| selected_properties = st.sidebar.multiselect( | |
| "Select Material Properties", options=list(properties.keys()) | |
| ) | |
| # Display the selected properties and their details | |
| if selected_properties: | |
| st.subheader("Selected Properties") | |
| for prop in selected_properties: | |
| st.write(f"**{prop}**: {', '.join(properties[prop])}") | |
| else: | |
| st.write("No properties selected.") | |
| # Allow user to select materials | |
| selected_materials = st.sidebar.multiselect( | |
| "Select Material Types", options=list(materials.keys()) | |
| ) | |
| # Display the selected materials and their details | |
| if selected_materials: | |
| st.subheader("Selected Materials") | |
| for mat in selected_materials: | |
| st.write(f"**{mat}**: {', '.join(materials[mat])}") | |
| else: | |
| st.write("No materials selected.") | |
| # Provide additional information based on selections | |
| if selected_properties and selected_materials: | |
| st.subheader("Summary") | |
| st.write( | |
| "You selected the following properties and materials. Use this information to refine your design process!" | |
| ) | |
| st.write("Customize the app further to suit your needs!") | |