Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| # Predefined compound boiling points (Celsius) | |
| organic_compounds = { | |
| "Methane": -161.5, | |
| "Ethane": -88.6, | |
| "Propane": -42.1, | |
| "Butane": -0.5, | |
| "Pentane": 36.1, | |
| "Hexane": 68.7, | |
| "Heptane": 98.4, | |
| "Octane": 125.6, | |
| "Nonane": 150.8, | |
| "Decane": 174.1, | |
| "Ethanol": 78.4, | |
| "Methanol": 64.7, | |
| "Acetone": 56.0, | |
| "Benzene": 80.1, | |
| "Toluene": 110.6, | |
| "Phenol": 181.7, | |
| "Chloroform": 61.2, | |
| "Formaldehyde": -19.0, | |
| "Acetic Acid": 118.0, | |
| "Diethyl Ether": 34.6, | |
| "Aniline": 184.1, | |
| "Nitrobenzene": 210.9, | |
| "Styrene": 145.0, | |
| "Cyclohexane": 80.7, | |
| "Isopropanol": 82.5 | |
| } | |
| inorganic_compounds = { | |
| "Water": 100.0, | |
| "Ammonia": -33.3, | |
| "Hydrogen": -252.9, | |
| "Oxygen": -183.0, | |
| "Nitrogen": -195.8, | |
| "Carbon Dioxide": -78.5, | |
| "Sulfur Dioxide": -10.0, | |
| "Chlorine": -34.0, | |
| "Hydrogen Chloride": -85.1, | |
| "Sodium": 883.0, | |
| "Potassium": 759.0, | |
| "Calcium": 1484.0, | |
| "Iron": 2862.0, | |
| "Copper": 2562.0, | |
| "Zinc": 907.0, | |
| "Lead": 1749.0, | |
| "Mercury": 356.7, | |
| "Phosphorus (White)": 280.5, | |
| "Sulfur": 444.6, | |
| "Argon": -185.8, | |
| "Neon": -246.0, | |
| "Helium": -268.9, | |
| "Krypton": -153.4, | |
| "Xenon": -108.1, | |
| "Radon": -61.7 | |
| } | |
| # Streamlit UI | |
| st.title("Boiling Point Estimator 🔥💧") | |
| # Category selection | |
| category = st.radio("Select Compound Category", ["Organic", "Inorganic"]) | |
| # Compound selection | |
| if category == "Organic": | |
| compound = st.selectbox("Select Organic Compound", list(organic_compounds.keys())) | |
| boiling_point_c = organic_compounds[compound] | |
| else: | |
| compound = st.selectbox("Select Inorganic Compound", list(inorganic_compounds.keys())) | |
| boiling_point_c = inorganic_compounds[compound] | |
| # Unit selection | |
| unit = st.radio("Select Units", ["Celsius (°C)", "Fahrenheit (°F)"]) | |
| # Conversion | |
| if unit == "Celsius (°C)": | |
| result = f"{boiling_point_c:.2f} °C" | |
| else: | |
| boiling_point_f = (boiling_point_c * 9/5) + 32 | |
| result = f"{boiling_point_f:.2f} °F" | |
| # Display result | |
| st.success(f"**Boiling Point of {compound}: {result}**") | |