MuhammadHananKhan123 commited on
Commit
867fdcf
·
verified ·
1 Parent(s): f4cec47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +75 -1
app.py CHANGED
@@ -231,4 +231,78 @@ if st.button("Find Materials"):
231
  else:
232
  st.error("Please provide both inputs to search for materials.")
233
  if __name__ == "__main__":
234
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  else:
232
  st.error("Please provide both inputs to search for materials.")
233
  if __name__ == "__main__":
234
+ main()
235
+ # Load data for materials
236
+ @st.cache_data
237
+ def load_data():
238
+ # Material properties data
239
+ materials_data = {
240
+ "Metals": {
241
+ "Alkali Metals": ["Lithium", "Sodium", "Potassium"],
242
+ "Alkaline Earth Metals": ["Magnesium", "Calcium"],
243
+ "Transition Metals": ["Iron", "Copper", "Gold"],
244
+ },
245
+ "Polymers": {
246
+ "Thermoplastics": ["Polyethylene", "Polypropylene"],
247
+ "Thermosetting": ["Epoxy", "Phenolic"],
248
+ "Elastomers": ["Rubber", "Neoprene"],
249
+ },
250
+ "Ceramics": {
251
+ "Oxide Ceramics": ["Alumina", "Zirconia"],
252
+ "Carbide Ceramics": ["Silicon Carbide", "Tungsten Carbide"],
253
+ },
254
+ "Alloys": {
255
+ "Steel": ["High Carbon Steel", "Stainless Steel"],
256
+ "Titanium Alloys": ["Ti-6Al-4V", "CP-Titanium"],
257
+ }
258
+ }
259
+ return materials_data
260
+
261
+ materials_data = load_data()
262
+
263
+ # App Header
264
+ st.title("Material Selector App")
265
+ st.write("Identify the best material for making new objects based on your requirements.")
266
+
267
+ # Input from the user
268
+ industry = st.text_input("Enter the name of the industry (e.g., Aerospace, Construction, Medical, etc.):")
269
+ equipment_type = st.selectbox(
270
+ "Select the type of material group:",
271
+ options=["Metals", "Polymers", "Ceramics", "Alloys"]
272
+ )
273
+
274
+ # Display options based on material type
275
+ if equipment_type:
276
+ st.write(f"### Material Options for {equipment_type}:")
277
+ material_options = materials_data.get(equipment_type, {})
278
+ for category, items in material_options.items():
279
+ st.write(f"#### {category}:")
280
+ st.write(", ".join(items))
281
+
282
+ # Material property viewer (for further details)
283
+ st.write("\n")
284
+ st.write("---")
285
+ st.write("### View Material Properties")
286
+ selected_material = st.text_input("Enter the name of a material to view its properties:")
287
+
288
+ if selected_material:
289
+ # Mock property data for simplicity; you can expand this further
290
+ properties_data = {
291
+ "Lithium": {"Density (g/cm³)": 0.534, "Melting Point (°C)": 180.5, "Boiling Point (°C)": 1342},
292
+ "Iron": {"Density (g/cm³)": 7.874, "Melting Point (°C)": 1538, "Boiling Point (°C)": 2862},
293
+ "Polyethylene": {"Density (g/cm³)": 0.94, "Melting Point (°C)": 115, "Tensile Strength (MPa)": 37},
294
+ "Alumina": {"Density (g/cm³)": 3.95, "Melting Point (°C)": 2072, "Hardness (Mohs)": 9},
295
+ "Stainless Steel": {"Density (g/cm³)": 8.0, "Melting Point (°C)": 1510, "Tensile Strength (MPa)": 505}
296
+ }
297
+
298
+ material_properties = properties_data.get(selected_material)
299
+
300
+ if material_properties:
301
+ st.write(f"#### Properties of {selected_material}:")
302
+ st.json(material_properties)
303
+ else:
304
+ st.write(f"Properties for {selected_material} are not available. Please try another material.")
305
+
306
+ # Footer
307
+ st.write("---")
308
+ st.write("Developed by [Your Name]. Powered by Streamlit and Deployable on Hugging Face Spaces.")