Update app.py
Browse files
app.py
CHANGED
@@ -165,6 +165,70 @@ def main():
|
|
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()
|
|
|
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 |
+
# Create a function for material selection
|
169 |
+
def material_selector(industry, equipment_material):
|
170 |
+
# Material database
|
171 |
+
materials_data = {
|
172 |
+
"Metals": [
|
173 |
+
{"Type": "Alkali Metals", "Properties": "Highly reactive, low density, low melting points, reacts with water", "Examples": "Lithium, Sodium, Potassium"},
|
174 |
+
{"Type": "Alkaline Earth Metals", "Properties": "Reactive, higher density than alkali, moderate melting points", "Examples": "Magnesium, Calcium"},
|
175 |
+
{"Type": "Transition Metals", "Properties": "High density, high melting points, excellent conductors", "Examples": "Iron, Copper, Gold"},
|
176 |
+
{"Type": "Post-Transition Metals", "Properties": "Soft, malleable, moderate conductivity", "Examples": "Aluminum, Lead, Tin"},
|
177 |
+
],
|
178 |
+
"Non-Metals": [
|
179 |
+
{"Type": "Hydrogen", "Properties": "Highly flammable, colorless, combines with oxygen to form water", "Examples": "H2"},
|
180 |
+
{"Type": "Carbon", "Properties": "Versatile, forms organic compounds", "Examples": "Graphite, Diamond"},
|
181 |
+
{"Type": "Nitrogen", "Properties": "Essential for life, inert in its gaseous state", "Examples": "N2"},
|
182 |
+
],
|
183 |
+
"Polymers": [
|
184 |
+
{"Type": "Thermoplastics", "Properties": "Softened and reshaped by heat, lightweight, flexible", "Examples": "Polyethylene, Polypropylene"},
|
185 |
+
{"Type": "Thermosetting", "Properties": "Strong, rigid, cannot be reshaped after curing", "Examples": "Epoxy Resin, Polyurethane"},
|
186 |
+
{"Type": "Elastomers", "Properties": "Elastic, returns to original shape", "Examples": "Rubber, Silicone"},
|
187 |
+
],
|
188 |
+
"Ceramics": [
|
189 |
+
{"Type": "Oxide Ceramics", "Properties": "High hardness, heat resistance", "Examples": "Alumina, Silica"},
|
190 |
+
{"Type": "Carbide Ceramics", "Properties": "Extremely hard, wear-resistant", "Examples": "Tungsten Carbide"},
|
191 |
+
{"Type": "Silicate Ceramics", "Properties": "High strength, chemically resistant", "Examples": "Glass, Porcelain"},
|
192 |
+
],
|
193 |
+
"Alloys": [
|
194 |
+
{"Type": "Steel", "Properties": "Strong, durable, malleable", "Examples": "Carbon Steel, Stainless Steel"},
|
195 |
+
{"Type": "Bronze", "Properties": "Corrosion-resistant, durable", "Examples": "Copper-Tin Alloy"},
|
196 |
+
{"Type": "Titanium Alloys", "Properties": "High strength-to-weight ratio, corrosion resistant", "Examples": "Ti-6Al-4V"},
|
197 |
+
],
|
198 |
+
}
|
199 |
|
200 |
+
# Filter materials based on input
|
201 |
+
matching_materials = []
|
202 |
+
for category, materials in materials_data.items():
|
203 |
+
for material in materials:
|
204 |
+
if industry.lower() in material["Properties"].lower() or equipment_material.lower() in material["Examples"].lower():
|
205 |
+
matching_materials.append({"Category": category, **material})
|
206 |
+
|
207 |
+
return matching_materials
|
208 |
+
|
209 |
+
# Streamlit App Layout
|
210 |
+
st.title("Material Selector for Industries and Equipment")
|
211 |
+
st.subheader("Select the best material for your industrial application")
|
212 |
+
|
213 |
+
# User Inputs
|
214 |
+
industry = st.text_input("Enter Industry Type (e.g., Aerospace, Automotive, Construction):")
|
215 |
+
equipment_material = st.text_input("Enter Equipment Material Requirement (e.g., Lightweight, Corrosion Resistant):")
|
216 |
+
|
217 |
+
if st.button("Find Materials"):
|
218 |
+
if industry and equipment_material:
|
219 |
+
# Get matching materials
|
220 |
+
results = material_selector(industry, equipment_material)
|
221 |
+
if results:
|
222 |
+
st.success(f"Found {len(results)} matching materials:")
|
223 |
+
for result in results:
|
224 |
+
st.write(f"**Category:** {result['Category']}")
|
225 |
+
st.write(f"**Type:** {result['Type']}")
|
226 |
+
st.write(f"**Properties:** {result['Properties']}")
|
227 |
+
st.write(f"**Examples:** {result['Examples']}")
|
228 |
+
st.write("---")
|
229 |
+
else:
|
230 |
+
st.warning("No matching materials found. Please refine your search.")
|
231 |
+
else:
|
232 |
+
st.error("Please provide both inputs to search for materials.")
|
233 |
if __name__ == "__main__":
|
234 |
main()
|