|
|
import streamlit as st |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
st.title("Material Selection Tool") |
|
|
st.write("Input the design requirements, and the tool will recommend suitable materials.") |
|
|
|
|
|
|
|
|
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"]) |
|
|
|
|
|
|
|
|
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.") |
|
|
|
|
|
|