MuhammadHananKhan123 commited on
Commit
a62631e
·
verified ·
1 Parent(s): b50a5db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -48
app.py CHANGED
@@ -1,49 +1,77 @@
1
- # app.py
2
- import streamlit as st
3
-
4
- def get_melting_boiling_points(matter_type):
5
- data = {
6
- "solids": {
7
- "examples": "Iron, Gold, Ice",
8
- "melting_point": "Typically high (e.g., Iron: 1538°C)",
9
- "boiling_point": "Typically very high (e.g., Iron: 2862°C)"
10
- },
11
- "liquids": {
12
- "examples": "Water, Mercury, Ethanol",
13
- "melting_point": "Typically low (e.g., Water: 0°C)",
14
- "boiling_point": "Moderate (e.g., Water: 100°C)"
15
- },
16
- "gases": {
17
- "examples": "Oxygen, Nitrogen, Helium",
18
- "melting_point": "Very low (e.g., Oxygen: -218.8°C)",
19
- "boiling_point": "Very low (e.g., Oxygen: -183°C)"
20
- },
21
- "plasma": {
22
- "examples": "Ionized gases (e.g., in stars or lightning)",
23
- "melting_point": "Not applicable",
24
- "boiling_point": "Not applicable"
25
- }
26
- }
27
- return data.get(matter_type.lower(), None)
28
-
29
- # Streamlit app
30
- st.title("Matter Properties Explorer")
31
- st.write("This app provides the melting and boiling points of various types of matter: solids, liquids, gases, and plasma.")
32
-
33
- # Dropdown to select matter type
34
- matter_type = st.selectbox(
35
- "Select the type of matter:",
36
- ("Solids", "Liquids", "Gases", "Plasma")
37
- )
38
-
39
- # Fetch and display information
40
- if matter_type:
41
- properties = get_melting_boiling_points(matter_type)
42
- if properties:
43
- st.subheader(f"Properties of {matter_type}")
44
- st.write(f"**Examples:** {properties['examples']}")
45
- st.write(f"**Melting Point:** {properties['melting_point']}")
46
- st.write(f"**Boiling Point:** {properties['boiling_point']}")
47
- else:
48
- st.error("Information not available for the selected matter type.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
 
1
+ import streamlit as st
2
+
3
+ # App title and introduction
4
+ st.title("Understanding Melting and Boiling Points of Matter")
5
+ st.subheader("Learn about the fundamental properties of matter!")
6
+
7
+ st.markdown("""
8
+ Matter exists in different states: **solids**, **liquids**, **gases**, and **plasma**.
9
+ Each state has unique properties influenced by temperature and pressure.
10
+ In this app, we explore the **melting points** and **boiling points** of various substances and states of matter.
11
+ """)
12
+
13
+ # Sidebar for navigation
14
+ st.sidebar.title("Navigation")
15
+ option = st.sidebar.radio("Choose a category", ("Introduction", "Solids", "Liquids", "Gases", "Plasma"))
16
+
17
+ if option == "Introduction":
18
+ st.header("Introduction to Melting and Boiling Points")
19
+ st.write("""
20
+ - **Melting Point**: The temperature at which a solid turns into a liquid.
21
+ - **Boiling Point**: The temperature at which a liquid turns into a gas.
22
+
23
+ These points depend on intermolecular forces, pressure, and the type of matter.
24
+ """)
25
+
26
+ st.info("Fun Fact: The boiling point of water is 100°C at sea level but decreases at higher altitudes due to lower atmospheric pressure!")
27
+
28
+ elif option == "Solids":
29
+ st.header("Melting and Boiling Points of Solids")
30
+ st.write("""
31
+ Solids have strong intermolecular forces, resulting in high melting and boiling points. Examples include:
32
+ - **Iron**: Melting Point = 1,538°C, Boiling Point = 2,862°C
33
+ - **Gold**: Melting Point = 1,064°C, Boiling Point = 2,700°C
34
+ - **Ice (H₂O)**: Melting Point = 0°C, Boiling Point = 100°C (when melted to water)
35
+ """)
36
+
37
+ st.image("https://upload.wikimedia.org/wikipedia/commons/3/38/Crystalline_Structure.jpg", caption="Crystalline Structure of Solids", use_column_width=True)
38
+
39
+ elif option == "Liquids":
40
+ st.header("Melting and Boiling Points of Liquids")
41
+ st.write("""
42
+ Liquids have moderate intermolecular forces, leading to relatively lower boiling points compared to solids. Examples include:
43
+ - **Water**: Boiling Point = 100°C
44
+ - **Mercury**: Boiling Point = 356.7°C
45
+ - **Ethanol**: Boiling Point = 78.37°C
46
+ """)
47
+
48
+ st.image("https://upload.wikimedia.org/wikipedia/commons/d/d4/Surface_Tension.jpg", caption="Surface Tension in Liquids", use_column_width=True)
49
+
50
+ elif option == "Gases":
51
+ st.header("Boiling Points of Gases")
52
+ st.write("""
53
+ Gases have very weak intermolecular forces. Examples include:
54
+ - **Oxygen (O₂)**: Boiling Point = -183°C
55
+ - **Nitrogen (N₂)**: Boiling Point = -196°C
56
+ - **Helium (He)**: Boiling Point = -268.9°C
57
+ """)
58
+
59
+ st.image("https://upload.wikimedia.org/wikipedia/commons/3/31/Helium-filled_balloon.jpg", caption="Helium Balloon", use_column_width=True)
60
+
61
+ elif option == "Plasma":
62
+ st.header("Understanding Plasma")
63
+ st.write("""
64
+ Plasma is a state of matter where gases are ionized, creating free electrons and ions. It doesn't have traditional melting or boiling points but exists at very high temperatures.
65
+
66
+ Examples:
67
+ - **Sun's Core**: Millions of degrees Celsius
68
+ - **Lightning**: Around 30,000°C
69
+ """)
70
+
71
+ st.image("https://upload.wikimedia.org/wikipedia/commons/a/a9/Plasma_globe_60th.jpg", caption="Plasma Globe", use_column_width=True)
72
+
73
+ # Footer
74
+ st.markdown("---")
75
+ st.markdown("Developed with ❤️ using [Streamlit](https://streamlit.io/) and deployed on [Hugging Face](https://huggingface.co).")
76
+
77