GUN_SIMULATION / app.py
amkj84's picture
Update app.py
86ca5d3 verified
raw
history blame
5.49 kB
import streamlit as st
import time
from streamlit_lottie import st_lottie
import requests
# Function to load Lottie animations
def load_lottie_url(url):
response = requests.get(url)
if response.status_code != 200:
return None
return response.json()
# Load Lottie animations
lottie_digestive_system = load_lottie_url("https://assets9.lottiefiles.com/packages/lf20_4xm9m9ic.json")
lottie_quiz_complete = load_lottie_url("https://assets8.lottiefiles.com/packages/lf20_s2lryxtd.json")
# Page Configurations
st.set_page_config(
page_title="CBT: Digestive System for Class 6",
layout="centered"
)
# Title and Description
st.title("🌟 CBT: Digestive System 🌟")
st.write("This Computer-Based Tutorial (CBT) is designed for Class 6 students to learn about the digestive system in a fun and interactive way.")
st.image("https://upload.wikimedia.org/wikipedia/commons/thumb/e/e5/Digestive_system_diagram_en.svg/1200px-Digestive_system_diagram_en.svg.png", caption="Digestive System Overview")
# Sidebar Navigation
st.sidebar.header("Navigation")
sections = ["Introduction", "Organs of the Digestive System", "Process of Digestion", "Quiz"]
selected_section = st.sidebar.radio("Select Section:", sections)
if selected_section == "Introduction":
st.header("Introduction")
st.write("The digestive system is a group of organs that work together to break down food into smaller parts so the body can use them for energy, growth, and repair.")
st_lottie(lottie_digestive_system, height=300, key="intro_animation")
# Relevant Digestive Process GIF from Giphy
st.image("https://media.giphy.com/media/jTqboGlCkiQ7e/giphy.gif", caption="Digestive Process (GIF)") # Updated relevant GIF
st.balloons()
elif selected_section == "Organs of the Digestive System":
st.header("Organs of the Digestive System")
st.write("The digestive system includes the following major organs:")
st.markdown("""
- **Mouth**: The starting point of digestion where food is chewed and mixed with saliva.
- **Esophagus**: A tube that connects the mouth to the stomach.
- **Stomach**: Breaks down food using acids and enzymes.
- **Small Intestine**: Absorbs nutrients from food.
- **Large Intestine**: Absorbs water and forms waste products.
- **Liver**: Produces bile to help digest fats.
- **Pancreas**: Produces enzymes that help in digestion.
- **Rectum and Anus**: Store and eliminate waste.
""")
st.image("https://cdn.pixabay.com/photo/2017/07/25/13/01/intestine-2531936_960_720.png", caption="Illustration of Digestive Organs")
# Embedding a video related to digestive organs
st.video("https://www.youtube.com/watch?v=1H2V9X4TcK0", caption="Digestive System Organs Video")
elif selected_section == "Process of Digestion":
st.header("Process of Digestion")
st.write("The process of digestion involves several steps:")
st.markdown("""
1. **Ingestion**: Food enters the mouth.
2. **Propulsion**: Food moves through the esophagus to the stomach.
3. **Mechanical Digestion**: Food is physically broken down into smaller pieces.
4. **Chemical Digestion**: Enzymes break down food into simpler molecules.
5. **Absorption**: Nutrients are absorbed into the bloodstream in the small intestine.
6. **Elimination**: Waste is eliminated through the rectum and anus.
""")
st.image("https://cdn.pixabay.com/photo/2017/07/25/13/01/digestive-2531937_960_720.png", caption="Step-by-step Digestive Process")
# Adding a relevant Digestive Process GIF
st.image("https://media.giphy.com/media/jTqboGlCkiQ7e/giphy.gif", caption="Digestion in Action (GIF)") # Relevant GIF for digestion
with st.spinner("Simulating digestion..."):
time.sleep(2)
st.success("Digestion process explained!")
elif selected_section == "Quiz":
st.header("🧠 Quiz: Test Your Knowledge")
st.write("Answer the following questions to test your knowledge of the digestive system.")
# Question 1
question1 = st.radio(
"1. Which organ is responsible for absorbing nutrients from food?",
("Mouth", "Stomach", "Small Intestine", "Large Intestine")
)
if question1 == "Small Intestine":
st.success("βœ… Correct! The small intestine absorbs nutrients from food.")
elif question1:
st.error("❌ Incorrect. The correct answer is 'Small Intestine'.")
# Question 2
question2 = st.radio(
"2. What is the function of bile?",
("To digest proteins", "To help digest fats", "To break down carbohydrates", "To eliminate waste")
)
if question2 == "To help digest fats":
st.success("βœ… Correct! Bile helps in the digestion of fats.")
elif question2:
st.error("❌ Incorrect. The correct answer is 'To help digest fats'.")
# Question 3
question3 = st.radio(
"3. Which organ produces enzymes for digestion?",
("Liver", "Stomach", "Pancreas", "Esophagus")
)
if question3 == "Pancreas":
st.success("βœ… Correct! The pancreas produces enzymes that aid in digestion.")
elif question3:
st.error("❌ Incorrect. The correct answer is 'Pancreas'.")
st.write("πŸŽ‰ Keep learning and practicing! Great job!")
st_lottie(lottie_quiz_complete, height=300, key="quiz_animation")
# Embedding another video for quiz results
st.video("https://www.youtube.com/watch?v=2DlwJlXjqZ8", caption="Quiz Completion Video")