Spaces:
Runtime error
Runtime error
Commit
·
fd07f64
1
Parent(s):
3c20208
added quiz page
Browse files- .sessions/johndoe/level.txt +1 -0
- assets/quiz.json +92 -0
- pages/5_Quiz.py +51 -0
- pages/{5_Congratulations.py → 6_Congratulations.py} +8 -3
- utils/__pycache__/__init__.cpython-310.pyc +0 -0
- utils/__pycache__/inference.cpython-310.pyc +0 -0
- utils/__pycache__/levels.cpython-310.pyc +0 -0
- utils/__pycache__/login.cpython-310.pyc +0 -0
.sessions/johndoe/level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
6
|
assets/quiz.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"question": "Which of the following best describes emotion detection?",
|
| 4 |
+
"options": [
|
| 5 |
+
"Teaching computers to understand human emotions",
|
| 6 |
+
"Teaching humans to understand computer languages",
|
| 7 |
+
"Teaching computers to create video games",
|
| 8 |
+
"Teaching humans to recognize facial features"
|
| 9 |
+
],
|
| 10 |
+
"answer": "Teaching computers to understand human emotions"
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"question": "What programming language is commonly used in developing emotion detection applications?",
|
| 14 |
+
"options": [
|
| 15 |
+
"Python",
|
| 16 |
+
"Java",
|
| 17 |
+
"C++",
|
| 18 |
+
"Ruby"
|
| 19 |
+
],
|
| 20 |
+
"answer": "Python"
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"question": "What is the purpose of OpenCV in an emotion detection application?",
|
| 24 |
+
"options": [
|
| 25 |
+
"To analyze and manipulate images and videos",
|
| 26 |
+
"To recognize and understand human emotions",
|
| 27 |
+
"To create graphical user interfaces",
|
| 28 |
+
"To generate statistical reports"
|
| 29 |
+
],
|
| 30 |
+
"answer": "To analyze and manipulate images and videos"
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"question": "Why is it important to have a diverse dataset when training an emotion detection model?",
|
| 34 |
+
"options": [
|
| 35 |
+
"It helps the model better understand different facial expressions",
|
| 36 |
+
"It improves the performance of the computer's processor",
|
| 37 |
+
"It makes the application run faster",
|
| 38 |
+
"It reduces the training time for the model"
|
| 39 |
+
],
|
| 40 |
+
"answer": "It helps the model better understand different facial expressions"
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"question": "What is the final step after training the model in an emotion detection application?",
|
| 44 |
+
"options": [
|
| 45 |
+
"Collect more data for training",
|
| 46 |
+
"Test the model's accuracy and performance",
|
| 47 |
+
"Install additional software plugins",
|
| 48 |
+
"Optimize the application's user interface"
|
| 49 |
+
],
|
| 50 |
+
"answer": "Test the model's accuracy and performance"
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"question": "How does the inference process work in an emotion detection application?",
|
| 54 |
+
"options": [
|
| 55 |
+
"It analyzes facial features and predicts the associated emotion",
|
| 56 |
+
"It collects user feedback and improves the model's accuracy",
|
| 57 |
+
"It converts emotions into numerical values for analysis",
|
| 58 |
+
"It adjusts the application's settings based on user preferences"
|
| 59 |
+
],
|
| 60 |
+
"answer": "It analyzes facial features and predicts the associated emotion"
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"question": "What is an example of a real-world application of emotion detection technology?",
|
| 64 |
+
"options": [
|
| 65 |
+
"Virtual reality gaming",
|
| 66 |
+
"Weather forecasting",
|
| 67 |
+
"Online shopping",
|
| 68 |
+
"Recipe suggestions"
|
| 69 |
+
],
|
| 70 |
+
"answer": "Virtual reality gaming"
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"question": "What is the importance of ethical considerations in emotion detection applications?",
|
| 74 |
+
"options": [
|
| 75 |
+
"Ensuring privacy and consent when collecting data",
|
| 76 |
+
"Optimizing the application's performance",
|
| 77 |
+
"Reducing the complexity of the model",
|
| 78 |
+
"Enhancing the visual appearance of the application"
|
| 79 |
+
],
|
| 80 |
+
"answer": "Ensuring privacy and consent when collecting data"
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"question": "What can students do to further explore and improve their emotion detection application?",
|
| 84 |
+
"options": [
|
| 85 |
+
"Experiment with different image preprocessing techniques",
|
| 86 |
+
"Rewrite the entire code from scratch",
|
| 87 |
+
"Avoid using real-time video feeds for testing",
|
| 88 |
+
"Skip the testing phase and move directly to deployment"
|
| 89 |
+
],
|
| 90 |
+
"answer": "Experiment with different image preprocessing techniques"
|
| 91 |
+
}
|
| 92 |
+
]
|
pages/5_Quiz.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from utils.levels import complete_level, render_page, initialize_level
|
| 3 |
+
from utils.login import initialize_login
|
| 4 |
+
import random
|
| 5 |
+
import json
|
| 6 |
+
|
| 7 |
+
LEVEL = 5
|
| 8 |
+
|
| 9 |
+
initialize_login()
|
| 10 |
+
initialize_level()
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
if "questions" not in st.session_state:
|
| 14 |
+
with open("assets/quiz.json") as f:
|
| 15 |
+
questions = json.load(f)
|
| 16 |
+
|
| 17 |
+
for i in range(len(questions)):
|
| 18 |
+
random.shuffle(questions[i]["options"])
|
| 19 |
+
random.shuffle(questions)
|
| 20 |
+
|
| 21 |
+
st.session_state["questions"] = questions
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def step_page():
|
| 25 |
+
st.header("Quiz")
|
| 26 |
+
st.markdown(
|
| 27 |
+
"""Now that you've learned about how Face Recognition work, let's test your knowledge with a quiz!"""
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
for i in range(len(st.session_state["questions"])):
|
| 31 |
+
st.subheader(f"Question {i + 1}")
|
| 32 |
+
question = st.session_state["questions"][i]
|
| 33 |
+
st.markdown(question["question"])
|
| 34 |
+
answer = st.radio("Select an answer:", question["options"], key=f"radio{i}")
|
| 35 |
+
|
| 36 |
+
if st.session_state.get("EVALUATE", False):
|
| 37 |
+
if answer == question["answer"]:
|
| 38 |
+
st.success("Correct!")
|
| 39 |
+
else:
|
| 40 |
+
st.error("Incorrect! Try Again")
|
| 41 |
+
|
| 42 |
+
if st.button("Evaluate"):
|
| 43 |
+
st.session_state["EVALUATE"] = True
|
| 44 |
+
st.experimental_rerun()
|
| 45 |
+
|
| 46 |
+
st.info("Click on the button below to complete the tutorial!")
|
| 47 |
+
if st.button("Complete"):
|
| 48 |
+
complete_level(LEVEL)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
render_page(step_page, LEVEL)
|
pages/{5_Congratulations.py → 6_Congratulations.py}
RENAMED
|
@@ -3,10 +3,15 @@ from utils.levels import render_page, initialize_level
|
|
| 3 |
|
| 4 |
initialize_level()
|
| 5 |
|
| 6 |
-
LEVEL =
|
|
|
|
| 7 |
|
| 8 |
def complete_page():
|
| 9 |
st.header("Congratulations!")
|
| 10 |
-
st.subheader(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
render_page(complete_page, LEVEL)
|
|
|
|
| 3 |
|
| 4 |
initialize_level()
|
| 5 |
|
| 6 |
+
LEVEL = 6
|
| 7 |
+
|
| 8 |
|
| 9 |
def complete_page():
|
| 10 |
st.header("Congratulations!")
|
| 11 |
+
st.subheader(
|
| 12 |
+
"You have completed the tutorial! Now you know how to use Face Recognition to detect faces in images and videos!"
|
| 13 |
+
)
|
| 14 |
+
st.balloons()
|
| 15 |
+
|
| 16 |
|
| 17 |
+
render_page(complete_page, LEVEL)
|
utils/__pycache__/__init__.cpython-310.pyc
CHANGED
|
Binary files a/utils/__pycache__/__init__.cpython-310.pyc and b/utils/__pycache__/__init__.cpython-310.pyc differ
|
|
|
utils/__pycache__/inference.cpython-310.pyc
CHANGED
|
Binary files a/utils/__pycache__/inference.cpython-310.pyc and b/utils/__pycache__/inference.cpython-310.pyc differ
|
|
|
utils/__pycache__/levels.cpython-310.pyc
CHANGED
|
Binary files a/utils/__pycache__/levels.cpython-310.pyc and b/utils/__pycache__/levels.cpython-310.pyc differ
|
|
|
utils/__pycache__/login.cpython-310.pyc
CHANGED
|
Binary files a/utils/__pycache__/login.cpython-310.pyc and b/utils/__pycache__/login.cpython-310.pyc differ
|
|
|