Update app.py
Browse files
app.py
CHANGED
|
@@ -47,4 +47,124 @@ def get_material_recommendation(industry, equipment, material_type):
|
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
| 49 |
main()
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
| 49 |
main()
|
| 50 |
+
|
| 51 |
+
# Dictionary containing material data
|
| 52 |
+
MATERIALS = {
|
| 53 |
+
"Metals": {
|
| 54 |
+
"Alkali Metals": [
|
| 55 |
+
"Highly reactive metals",
|
| 56 |
+
"Soft, silvery-white in appearance",
|
| 57 |
+
"Low density and melting points",
|
| 58 |
+
"React vigorously with water to produce hydrogen gas and metal hydroxides",
|
| 59 |
+
"Examples: Lithium, Sodium, Potassium, etc."
|
| 60 |
+
],
|
| 61 |
+
"Transition Metals": [
|
| 62 |
+
"High melting and boiling points",
|
| 63 |
+
"Good conductors of heat and electricity",
|
| 64 |
+
"Form colored compounds",
|
| 65 |
+
"Examples: Iron, Copper, Gold, etc."
|
| 66 |
+
],
|
| 67 |
+
# Add more metal categories here
|
| 68 |
+
},
|
| 69 |
+
"Non-metals": {
|
| 70 |
+
"Oxygen": [
|
| 71 |
+
"Essential for respiration and combustion",
|
| 72 |
+
"Reacts with most elements to form oxides",
|
| 73 |
+
"Supports life and used in industrial processes",
|
| 74 |
+
],
|
| 75 |
+
"Carbon": [
|
| 76 |
+
"Exists in various forms (diamond, graphite)",
|
| 77 |
+
"Backbone of organic compounds",
|
| 78 |
+
"Used in fuels, materials, and electronics",
|
| 79 |
+
],
|
| 80 |
+
# Add more non-metals here
|
| 81 |
+
},
|
| 82 |
+
"Metalloids": {
|
| 83 |
+
"Silicon": [
|
| 84 |
+
"Essential for electronics as a semiconductor",
|
| 85 |
+
"Used in glass, ceramics, and solar cells",
|
| 86 |
+
"Second most abundant element in Earth’s crust",
|
| 87 |
+
],
|
| 88 |
+
"Boron": [
|
| 89 |
+
"Used in semiconductors and ceramics",
|
| 90 |
+
"Essential micronutrient for plants",
|
| 91 |
+
"High melting and boiling points",
|
| 92 |
+
],
|
| 93 |
+
# Add more metalloids here
|
| 94 |
+
},
|
| 95 |
+
"Polymers": {
|
| 96 |
+
"Thermoplastics": [
|
| 97 |
+
"Can be softened and reshaped multiple times",
|
| 98 |
+
"Examples: Polyethylene, Polypropylene",
|
| 99 |
+
"Good electrical insulators and chemical resistance",
|
| 100 |
+
],
|
| 101 |
+
"Thermosetting Polymers": [
|
| 102 |
+
"Rigid, strong, and heat-resistant",
|
| 103 |
+
"Examples: Epoxy resins, Polyurethane",
|
| 104 |
+
"Good electrical insulators",
|
| 105 |
+
],
|
| 106 |
+
# Add more polymer types here
|
| 107 |
+
},
|
| 108 |
+
"Ceramics": {
|
| 109 |
+
"Oxide Ceramics": [
|
| 110 |
+
"High melting points and hardness",
|
| 111 |
+
"Examples: Alumina, Zirconia",
|
| 112 |
+
"Used in high-temperature applications",
|
| 113 |
+
],
|
| 114 |
+
"Carbide Ceramics": [
|
| 115 |
+
"Extremely hard and wear-resistant",
|
| 116 |
+
"Examples: Tungsten carbide, Silicon carbide",
|
| 117 |
+
"Used in cutting tools and engine components",
|
| 118 |
+
],
|
| 119 |
+
# Add more ceramics here
|
| 120 |
+
},
|
| 121 |
+
"Alloys": {
|
| 122 |
+
"Steel": [
|
| 123 |
+
"High strength and durability",
|
| 124 |
+
"Used in construction and manufacturing",
|
| 125 |
+
"Resistant to corrosion when alloyed with chromium",
|
| 126 |
+
],
|
| 127 |
+
"Bronze": [
|
| 128 |
+
"Hard and durable",
|
| 129 |
+
"Used in sculptures, bells, and bearings",
|
| 130 |
+
"Resistant to corrosion",
|
| 131 |
+
],
|
| 132 |
+
# Add more alloys here
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
def main():
|
| 137 |
+
st.title("Material Selector")
|
| 138 |
+
st.write("Use this app to identify the correct material for designing equipment and industries.")
|
| 139 |
+
|
| 140 |
+
# Input fields for industry and equipment type
|
| 141 |
+
industry = st.text_input("Enter the Industry (e.g., Aerospace, Automotive, etc.):")
|
| 142 |
+
equipment = st.text_input("Enter the Equipment Name (e.g., Engine, Pipes, etc.):")
|
| 143 |
+
|
| 144 |
+
st.write("### Material Categories")
|
| 145 |
+
|
| 146 |
+
# Dropdown menu to select material category
|
| 147 |
+
category = st.selectbox("Select a Material Category:", list(MATERIALS.keys()))
|
| 148 |
+
|
| 149 |
+
# Display materials and their properties
|
| 150 |
+
if category:
|
| 151 |
+
st.subheader(f"{category} Properties")
|
| 152 |
+
for subcategory, properties in MATERIALS[category].items():
|
| 153 |
+
with st.expander(subcategory):
|
| 154 |
+
for property in properties:
|
| 155 |
+
st.write(f"- {property}")
|
| 156 |
+
|
| 157 |
+
# Display recommendations based on user inputs (example logic)
|
| 158 |
+
if industry and equipment:
|
| 159 |
+
st.write("### Recommended Materials")
|
| 160 |
+
st.write(f"For **{equipment}** in the **{industry}** industry, consider the following materials:")
|
| 161 |
+
|
| 162 |
+
if "steel" in equipment.lower() or "construction" in industry.lower():
|
| 163 |
+
st.write("- **Steel**: High strength and durability, widely used in construction.")
|
| 164 |
+
if "electronics" in industry.lower():
|
| 165 |
+
st.write("- **Silicon**: Essential for semiconductors and electronics.")
|
| 166 |
+
if "high temperature" in equipment.lower() or "aerospace" in industry.lower():
|
| 167 |
+
st.write("- **Titanium Alloys**: High strength-to-weight ratio and excellent corrosion resistance.")
|
| 168 |
+
|
| 169 |
+
if __name__ == "__main__":
|
| 170 |
+
main()
|