MuhammadHananKhan123 commited on
Commit
ac80e45
·
verified ·
1 Parent(s): eb7c0ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -0
app.py CHANGED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ # Define the list of materials with properties
4
+ MATERIALS = {
5
+ "Aluminum": {"Strength": "High", "Weight": "Low", "Cost": "Medium", "Corrosion Resistance": "High"},
6
+ "Steel": {"Strength": "Very High", "Weight": "High", "Cost": "Low", "Corrosion Resistance": "Medium"},
7
+ "Titanium": {"Strength": "Very High", "Weight": "Medium", "Cost": "High", "Corrosion Resistance": "High"},
8
+ "Plastic": {"Strength": "Low", "Weight": "Very Low", "Cost": "Low", "Corrosion Resistance": "Medium"},
9
+ "Composite": {"Strength": "High", "Weight": "Low", "Cost": "Very High", "Corrosion Resistance": "High"},
10
+ }
11
+
12
+ def recommend_material(criteria):
13
+ recommendations = []
14
+ for material, properties in MATERIALS.items():
15
+ if all(properties[key] == value for key, value in criteria.items()):
16
+ recommendations.append(material)
17
+ return recommendations
18
+
19
+ # Streamlit App
20
+ st.title("Material Selection Tool")
21
+ st.write("Input the design requirements, and the tool will recommend suitable materials.")
22
+
23
+ # Input Case Study Details
24
+ st.header("Case Study Inputs")
25
+ strength = st.selectbox("Required Strength", ["Low", "Medium", "High", "Very High"])
26
+ weight = st.selectbox("Weight Importance", ["Very Low", "Low", "Medium", "High"])
27
+ cost = st.selectbox("Budget Constraint", ["Low", "Medium", "High", "Very High"])
28
+ corrosion_resistance = st.selectbox("Corrosion Resistance Need", ["Low", "Medium", "High", "Very High"])
29
+
30
+ # Material Recommendation
31
+ st.header("Material Recommendation")
32
+ criteria = {
33
+ "Strength": strength,
34
+ "Weight": weight,
35
+ "Cost": cost,
36
+ "Corrosion Resistance": corrosion_resistance,
37
+ }
38
+
39
+ recommendations = recommend_material(criteria)
40
+
41
+ if recommendations:
42
+ st.success(f"Recommended Materials: {', '.join(recommendations)}")
43
+ else:
44
+ st.error("No materials match the specified criteria. Try adjusting the inputs.")
45
+
46
+ st.write("---")
47
+ st.caption("This app is designed to help in selecting materials based on specified case study requirements.")
48
+