machineLearning / pages /02_ml_vs_dl.py
yash-gupta-01's picture
pages old commit
2ae5419
# import streamlit as st
# from streamlit_lottie import st_lottie
# import requests
# # Function to load Lottie animations
# def load_lottie_url(url: str):
# response = requests.get(url)
# if response.status_code != 200:
# return None
# return response.json()
# # Load Lottie animations (you can uncomment these as per your need)
# # lottie_ml = load_lottie_url("https://assets8.lottiefiles.com/packages/lf20_5eyehzdr.json")
# # lottie_dl = load_lottie_url("https://assets8.lottiefiles.com/packages/lf20_vfnu1k6m.json")
# # Sidebar navigation
# st.sidebar.title("Navigation")
# page = st.sidebar.radio("Go to:", ["Home", "ML vs DL", "Comparison Table"])
# # Add Navigate button to update page
# if st.sidebar.button("Navigate"):
# st.session_state.page = page
# # Set page to session state if not already defined
# if "page" not in st.session_state:
# st.session_state.page = page
# # Home page
# if st.session_state.page == "Home":
# st.title("Understanding Machine Learning and Deep Learning")
# st.markdown(
# """
# Welcome to the interactive guide on Machine Learning (ML) and Deep Learning (DL). This space helps you
# explore the differences, capabilities, and applications of ML and DL in a structured manner.
# """
# )
# # If lottie_ml is loaded, display it (uncomment the following line when using animations)
# # if lottie_ml:
# # st_lottie(lottie_ml, height=300, key="ml_home")
# # ML vs DL page
# elif st.session_state.page == "ML vs DL":
# st.title("Difference Between Machine Learning (ML) and Deep Learning (DL)")
# st.subheader("Machine Learning πŸ–₯️")
# st.markdown(
# """
# - Uses statistics to understand patterns in data and make predictions πŸ“Š.
# - Can learn with less data πŸ“‰.
# - Handles structured data; unstructured data must be converted to structured form πŸ”„.
# - Requires less memory πŸ§ πŸ’Ύ.
# - Trains models in less time ⏱️.
# - Can run efficiently on CPUs without requiring powerful hardware πŸ–₯️.
# """
# )
# st.subheader("Deep Learning πŸ€–")
# st.markdown(
# """
# - Uses neural networks to mimic brain-like learning and decision-making 🧠.
# - Requires large amounts of data for better accuracy πŸ½οΈπŸ“Š.
# - Handles both structured and unstructured data like images, text, and audio πŸ–ΌοΈπŸ“πŸŽ§.
# - Requires more memory and storage πŸ§ πŸ’Ύ.
# - Takes more time to train due to complex calculations ⏱️.
# - Needs GPUs and advanced hardware for efficient processing πŸ–₯οΈπŸ’‘.
# """
# )
# # If lottie_dl is loaded, display it (uncomment the following line when using animations)
# # if lottie_dl:
# # st_lottie(lottie_dl, height=300, key="dl_page")
# # Comparison Table page
# elif st.session_state.page == "Comparison Table":
# st.title("Comparison Table: ML vs DL")
# st.markdown(
# """
# | **Aspect** | **Machine Learning (ML)** | **Deep Learning (DL)** |
# |-------------------------|-------------------------------------------------|-------------------------------------------------|
# | **Definition** | Uses algorithms and statistics to learn from data. | Uses neural networks to mimic brain-like decision-making. |
# | **Data Dependency** | Works well with smaller datasets. | Requires large datasets for better accuracy. |
# | **Data Type** | Handles structured data only. | Handles both structured and unstructured data. |
# | **Training Time** | Requires less time to train. | Requires more time to train. |
# | **Hardware** | Can run on CPUs. | Requires GPUs and advanced hardware. |
# | **Memory Requirement** | Uses less memory. | Requires more memory and storage. |
# """
# )
# st.info(
# "Did you know? Deep Learning models are inspired by the human brain, making them exceptionally powerful for tasks like image recognition and natural language processing!"
# )
import streamlit as st
from streamlit_lottie import st_lottie
import requests
# Function to load Lottie animations
def load_lottie_url(url: str):
response = requests.get(url)
if response.status_code != 200:
return None
return response.json()
# Sidebar navigation
st.sidebar.title("Navigation")
page = st.sidebar.radio("Go to:", ["Home", "ML vs DL", "Comparison Table"])
# Initialize session state if not already done
if "page" not in st.session_state:
st.session_state.page = page
else:
st.session_state.page = page # Automatically update the session state when the radio selection changes
# Home page
if st.session_state.page == "Home":
st.title("Understanding Machine Learning and Deep Learning")
st.markdown(
"""
Welcome to the interactive guide on Machine Learning (ML) and Deep Learning (DL). This space helps you
explore the differences, capabilities, and applications of ML and DL in a structured manner.
"""
)
# ML vs DL page
elif st.session_state.page == "ML vs DL":
st.title("Difference Between Machine Learning (ML) and Deep Learning (DL)")
st.subheader("Machine Learning πŸ–₯️")
st.markdown(
"""
- Uses statistics to understand patterns in data and make predictions πŸ“Š.
- Can learn with less data πŸ“‰.
- Handles structured data; unstructured data must be converted to structured form πŸ”„.
- Requires less memory πŸ§ πŸ’Ύ.
- Trains models in less time ⏱️.
- Can run efficiently on CPUs without requiring powerful hardware πŸ–₯️.
"""
)
st.subheader("Deep Learning πŸ€–")
st.markdown(
"""
- Uses neural networks to mimic brain-like learning and decision-making 🧠.
- Requires large amounts of data for better accuracy πŸ½οΈπŸ“Š.
- Handles both structured and unstructured data like images, text, and audio πŸ–ΌοΈπŸ“πŸŽ§.
- Requires more memory and storage πŸ§ πŸ’Ύ.
- Takes more time to train due to complex calculations ⏱️.
- Needs GPUs and advanced hardware for efficient processing πŸ–₯οΈπŸ’‘.
"""
)
# Comparison Table page
elif st.session_state.page == "Comparison Table":
st.title("Comparison Table: ML vs DL")
st.markdown(
"""
| **Aspect** | **Machine Learning (ML)** | **Deep Learning (DL)** |
|-------------------------|-------------------------------------------------|-------------------------------------------------|
| **Definition** | Uses algorithms and statistics to learn from data. | Uses neural networks to mimic brain-like decision-making. |
| **Data Dependency** | Works well with smaller datasets. | Requires large datasets for better accuracy. |
| **Data Type** | Handles structured data only. | Handles both structured and unstructured data. |
| **Training Time** | Requires less time to train. | Requires more time to train. |
| **Hardware** | Can run on CPUs. | Requires GPUs and advanced hardware. |
| **Memory Requirement** | Uses less memory. | Requires more memory and storage. |
"""
)
st.info(
"Did you know? Deep Learning models are inspired by the human brain, making them exceptionally powerful for tasks like image recognition and natural language processing!"
)