Spaces:
Build error
Build error
import streamlit as st | |
from streamlit_lottie import st_lottie | |
import requests | |
# Function to load Lottie animations | |
def load_lottie_url(url: str): | |
r = requests.get(url) | |
if r.status_code == 200: | |
return r.json() | |
else: | |
return None | |
# Function to display the content of each page | |
def show_content(topic): | |
if topic == "Introduction": | |
st.title("Understanding Data Science and Artificial Intelligence π") | |
st.subheader("Overview of AI and Data Science") | |
st.write(""" | |
Artificial Intelligence (AI) and Data Science have become buzzwords in today's tech-driven world. | |
But what do they really mean, and why are they so significant? Letβs explore these fascinating concepts step by step! | |
""") | |
# Load the Lottie animation | |
lottie_url = "https://assets4.lottiefiles.com/packages/lf20_tcbkqj.json" | |
animation_data = load_lottie_url(lottie_url) | |
if animation_data: | |
st_lottie(animation_data, speed=1, width=600, height=400) | |
else: | |
st.write("Unable to load animation.") | |
elif topic == "Understanding Intelligence": | |
st.title("Understanding Intelligence") | |
st.subheader("What is Natural Intelligence? πΎ") | |
st.write(""" | |
**Definition**: NI refers to the intelligence naturally present in living beings. | |
**Examples**: | |
- A dog learning a trick. π | |
- Humans solving puzzles or making everyday decisions. π§ | |
""") | |
st.subheader("What is Artificial Intelligence? π€") | |
st.write(""" | |
**Definition**: Artificial intelligence (AI) is man-made intelligence where machines mimic human intelligence to perform tasks. | |
**Real-Life Examples**: | |
- Netflix recommending shows youβd love. π¬ | |
- Google Maps finding the fastest route. πΊοΈ | |
- Alexa answering your questions. ποΈ | |
""") | |
elif topic == "AI Tools: ML, DL, and Gen-AI": | |
st.title("AI Tools: ML, DL, and Gen-AI") | |
st.subheader("Machine Learning (ML) π₯οΈ") | |
st.write(""" | |
- **What It Does**: ML enables machines to learn from patterns in data and make decisions. | |
- **How It Works**: Similar to teaching a toddler to recognize fruits, ML algorithms process large datasets to "learn" and predict outcomes. | |
- **Real-Life Applications**: Spam email detection π§, Predicting stock prices π. | |
""") | |
st.subheader("Deep Learning (DL) π€Ώ") | |
st.write(""" | |
- **What It Does**: DL uses neural networks to process and analyze complex data. | |
- **How It Works**: DL processes data in layers, enabling machines to perform sophisticated tasks like facial recognition and medical imaging. | |
- **Real-Life Applications**: Self-driving cars π, Virtual assistants like Siri and Alexa. ποΈ | |
""") | |
st.subheader("Generative AI (Gen-AI) π¨") | |
st.write(""" | |
- **What It Does**: Gen-AI enables machines to generate new content like text, images, and music. | |
- **How It Works**: By learning patterns from data, Gen-AI creates outputs that feel original and human-like. | |
- **Real-Life Applications**: ChatGPT (text generation), DALLΒ·E (image creation). | |
""") | |
elif topic == "Real-Life Analogies and Examples": | |
st.title("Real-Life Analogies and Examples") | |
st.subheader("Analogy: Tools Are Like Pens and Pencils") | |
st.write(""" | |
- ML: Learns patterns (like sketching with a pencil). | |
- DL: Adds depth and detail (like using a pen). | |
- Gen-AI: Creates entirely new outputs (like turning sketches into colorful artwork). | |
""") | |
st.subheader("Learning vs. Generating: The Art Example π©βπ¨") | |
st.write(""" | |
Think of a child learning to draw: | |
- First, they learn the basics of drawing. | |
- Then they generate their own unique artwork. | |
AI follows the same process: | |
- Learning: ML and DL handle this part. | |
- Generating: Gen-AI takes over to create new outputs. | |
""") | |
elif topic == "What is Data Science?": | |
st.title("What is Data Science? π") | |
st.write(""" | |
Data Science is the art of extracting meaningful insights from raw data. It combines AI with statistics, computer science, and domain expertise to solve real-world problems. | |
**Key Components of Data Science**: | |
- **Data Collection**: Gathering information from various sources. | |
- **Data Analysis**: Using tools to find patterns and trends. | |
- **Data Visualization**: Presenting findings through charts and graphs. | |
""") | |
elif topic == "The Role of a Data Scientist": | |
st.title("The Role of a Data Scientist") | |
st.write(""" | |
A Data Scientist plays a crucial role in: | |
- Building predictive models. | |
- Analyzing customer behavior. | |
- Designing solutions for business challenges. | |
**Tools Used**: Python, R, SQL, Tableau, etc. | |
""") | |
elif topic == "Why AI and Data Science Matter": | |
st.title("Why AI and Data Science Matter") | |
st.write(""" | |
AI and Data Science are transforming industries by: | |
- Automating tasks. | |
- Enhancing decision-making. | |
- Unlocking creative possibilities. | |
**Fun Fact**: By 2030, AI is expected to add $15.7 trillion to the global economy. π | |
""") | |
elif topic == "Did You Know?": | |
st.title("Did You Know?") | |
st.write(""" | |
**AI is already being used to**: | |
- Detect diseases in medical imaging. | |
- Automate farming for higher crop yields. | |
- Generate movie scripts and music albums. | |
""") | |
# Set up sidebar navigation | |
topics = [ | |
"Introduction", | |
"Understanding Intelligence", | |
"AI Tools: ML, DL, and Gen-AI", | |
"Real-Life Analogies and Examples", | |
"What is Data Science?", | |
"The Role of a Data Scientist", | |
"Why AI and Data Science Matter", | |
"Did You Know?" | |
] | |
st.sidebar.title("Topics") | |
selection = st.sidebar.radio("Go to", topics) | |
# Initialize session state with the first topic as the default | |
if "page" not in st.session_state: | |
st.session_state.page = topics[0] | |
# Update session state automatically when sidebar selection changes | |
st.session_state.page = selection | |
# Display the selected content | |
show_content(st.session_state.page) | |