File size: 1,996 Bytes
ac80e45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import streamlit as st

# Define the list of materials with properties
MATERIALS = {
    "Aluminum": {"Strength": "High", "Weight": "Low", "Cost": "Medium", "Corrosion Resistance": "High"},
    "Steel": {"Strength": "Very High", "Weight": "High", "Cost": "Low", "Corrosion Resistance": "Medium"},
    "Titanium": {"Strength": "Very High", "Weight": "Medium", "Cost": "High", "Corrosion Resistance": "High"},
    "Plastic": {"Strength": "Low", "Weight": "Very Low", "Cost": "Low", "Corrosion Resistance": "Medium"},
    "Composite": {"Strength": "High", "Weight": "Low", "Cost": "Very High", "Corrosion Resistance": "High"},
}

def recommend_material(criteria):
    recommendations = []
    for material, properties in MATERIALS.items():
        if all(properties[key] == value for key, value in criteria.items()):
            recommendations.append(material)
    return recommendations

# Streamlit App
st.title("Material Selection Tool")
st.write("Input the design requirements, and the tool will recommend suitable materials.")

# Input Case Study Details
st.header("Case Study Inputs")
strength = st.selectbox("Required Strength", ["Low", "Medium", "High", "Very High"])
weight = st.selectbox("Weight Importance", ["Very Low", "Low", "Medium", "High"])
cost = st.selectbox("Budget Constraint", ["Low", "Medium", "High", "Very High"])
corrosion_resistance = st.selectbox("Corrosion Resistance Need", ["Low", "Medium", "High", "Very High"])

# Material Recommendation
st.header("Material Recommendation")
criteria = {
    "Strength": strength,
    "Weight": weight,
    "Cost": cost,
    "Corrosion Resistance": corrosion_resistance,
}

recommendations = recommend_material(criteria)

if recommendations:
    st.success(f"Recommended Materials: {', '.join(recommendations)}")
else:
    st.error("No materials match the specified criteria. Try adjusting the inputs.")

st.write("---")
st.caption("This app is designed to help in selecting materials based on specified case study requirements.")