Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
# Define the properties and their details
|
| 4 |
+
properties = {
|
| 5 |
+
"Mechanical": ["Tensile Strength", "Hardness", "Elasticity", "Ductility"],
|
| 6 |
+
"Chemical": ["Corrosion Resistance", "Reactivity", "pH Resistance"],
|
| 7 |
+
"Thermal": ["Thermal Conductivity", "Thermal Expansion", "Melting Point"],
|
| 8 |
+
"Electrical": ["Electrical Conductivity", "Resistivity", "Dielectric Strength"],
|
| 9 |
+
"Magnetic": ["Magnetic Permeability", "Coercivity", "Magnetic Retentivity"],
|
| 10 |
+
"Optical": ["Refractive Index", "Transparency", "Color"],
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
# Define the materials and their details
|
| 14 |
+
materials = {
|
| 15 |
+
"Metals": ["Iron", "Copper", "Aluminum", "Gold", "Silver"],
|
| 16 |
+
"Non-metals": ["Sulfur", "Carbon", "Oxygen"],
|
| 17 |
+
"Metalloids": ["Boron", "Silicon", "Arsenic"],
|
| 18 |
+
"Ceramics": ["Porcelain", "Glass", "Zirconia"],
|
| 19 |
+
"Polymers": ["Polyethylene", "Nylon", "Polycarbonate"],
|
| 20 |
+
"Alloys": ["Steel", "Brass", "Bronze"],
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
# Streamlit app layout
|
| 24 |
+
st.title("Material Selection Tool")
|
| 25 |
+
|
| 26 |
+
st.sidebar.header("Select Properties and Materials")
|
| 27 |
+
|
| 28 |
+
# Allow user to select properties
|
| 29 |
+
selected_properties = st.sidebar.multiselect(
|
| 30 |
+
"Select Material Properties", options=list(properties.keys())
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
# Display the selected properties and their details
|
| 34 |
+
if selected_properties:
|
| 35 |
+
st.subheader("Selected Properties")
|
| 36 |
+
for prop in selected_properties:
|
| 37 |
+
st.write(f"**{prop}**: {', '.join(properties[prop])}")
|
| 38 |
+
else:
|
| 39 |
+
st.write("No properties selected.")
|
| 40 |
+
|
| 41 |
+
# Allow user to select materials
|
| 42 |
+
selected_materials = st.sidebar.multiselect(
|
| 43 |
+
"Select Material Types", options=list(materials.keys())
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
# Display the selected materials and their details
|
| 47 |
+
if selected_materials:
|
| 48 |
+
st.subheader("Selected Materials")
|
| 49 |
+
for mat in selected_materials:
|
| 50 |
+
st.write(f"**{mat}**: {', '.join(materials[mat])}")
|
| 51 |
+
else:
|
| 52 |
+
st.write("No materials selected.")
|
| 53 |
+
|
| 54 |
+
# Provide additional information based on selections
|
| 55 |
+
if selected_properties and selected_materials:
|
| 56 |
+
st.subheader("Summary")
|
| 57 |
+
st.write(
|
| 58 |
+
"You selected the following properties and materials. Use this information to refine your design process!"
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
st.write("Customize the app further to suit your needs!")
|