Spaces:
Sleeping
Sleeping
Update prompts/main_prompt.py
Browse files- prompts/main_prompt.py +132 -140
prompts/main_prompt.py
CHANGED
@@ -1,140 +1,132 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
""
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
-
|
45 |
-
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
If
|
54 |
-
|
55 |
-
""
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
""
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
""
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
""
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
FINAL_REFLECTION_PROMPT = """
|
134 |
-
Final Reflection
|
135 |
-
|
136 |
-
- How does designing and solving problems using multiple representations enhance students’ mathematical creativity?
|
137 |
-
- How would you guide students to explain their reasoning, even if they get the correct answer?
|
138 |
-
|
139 |
-
Share your thoughts!
|
140 |
-
"""
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
# Step-by-step prompts
|
4 |
+
PROMPTS = [
|
5 |
+
# Task Introduction
|
6 |
+
"## Task: Representing Jessica’s Driving Distance 🚗\n"
|
7 |
+
"Jessica is driving at a constant speed. She travels **90 miles in 2 hours**.\n\n"
|
8 |
+
"### Your Goal:\n"
|
9 |
+
"Represent the relationship between **time and distance** using different mathematical models:\n"
|
10 |
+
"✅ Bar Model\n"
|
11 |
+
"✅ Double Number Line\n"
|
12 |
+
"✅ Ratio Table\n"
|
13 |
+
"✅ Graph\n\n"
|
14 |
+
"Let’s go through each representation step by step!",
|
15 |
+
|
16 |
+
# Step 1: Identifying Current Representation
|
17 |
+
"Which representations have you already used to show the relationship between time and distance?\n"
|
18 |
+
"- Bar Model\n"
|
19 |
+
"- Double Number Line\n"
|
20 |
+
"- Ratio Table\n"
|
21 |
+
"- Graph\n\n"
|
22 |
+
"If you haven’t used all of them, let’s go through each one step by step.",
|
23 |
+
|
24 |
+
# Step 2: Bar Model
|
25 |
+
"### Step 1: Bar Model Representation 📊\n"
|
26 |
+
"Have you created a **bar model** to represent Jessica’s travel?\n\n"
|
27 |
+
"**If not, follow these steps:**\n"
|
28 |
+
"1️⃣ Draw a **long bar** to represent **2 hours of driving**, labeling it **90 miles**.\n"
|
29 |
+
"2️⃣ Divide the bar into **two equal parts** to show **1 hour = 45 miles**.\n"
|
30 |
+
"3️⃣ Extend the bar to **3 hours** by adding another **45-mile segment**.\n"
|
31 |
+
"4️⃣ Divide **one 1-hour segment in half** to show **½ hour = 22.5 miles**.\n\n"
|
32 |
+
"✅ Does your bar model correctly show **½, 1, 2, and 3 hours**?",
|
33 |
+
|
34 |
+
# Step 3: Double Number Line
|
35 |
+
"### Step 2: Double Number Line Representation 📏\n"
|
36 |
+
"Have you created a **double number line** for time and distance?\n\n"
|
37 |
+
"**If not, follow these steps:**\n"
|
38 |
+
"1️⃣ Draw **two parallel number lines**:\n"
|
39 |
+
" - The **top line** represents **time (hours)**.\n"
|
40 |
+
" - The **bottom line** represents **distance (miles)**.\n"
|
41 |
+
"2️⃣ Mark these key points:\n"
|
42 |
+
" - **0 hours → 0 miles**\n"
|
43 |
+
" - **½ hour → 22.5 miles**\n"
|
44 |
+
" - **1 hour → 45 miles**\n"
|
45 |
+
" - **2 hours → 90 miles**\n"
|
46 |
+
" - **3 hours → 135 miles**\n"
|
47 |
+
"3️⃣ Ensure the distances are evenly spaced.\n\n"
|
48 |
+
"✅ Does your number line show a **proportional relationship**?",
|
49 |
+
|
50 |
+
# Step 4: Ratio Table
|
51 |
+
"### Step 3: Ratio Table Representation 📋\n"
|
52 |
+
"Have you created a **ratio table**?\n\n"
|
53 |
+
"**If not, follow these steps:**\n"
|
54 |
+
"1️⃣ Fill in the table below:\n\n"
|
55 |
+
"| Time (hours) | Distance (miles) |\n"
|
56 |
+
"|-------------|-----------------|\n"
|
57 |
+
"| 0.5 | 22.5 |\n"
|
58 |
+
"| 1 | 45 |\n"
|
59 |
+
"| 2 | 90 |\n"
|
60 |
+
"| 3 | 135 |\n\n"
|
61 |
+
"2️⃣ Look for patterns.\n"
|
62 |
+
"3️⃣ What would be the distance for **4 hours**?\n\n"
|
63 |
+
"✅ Does your table clearly show a **proportional pattern**?",
|
64 |
+
|
65 |
+
# Step 5: Graph
|
66 |
+
"### Step 4: Graph Representation 📈\n"
|
67 |
+
"Have you created a **graph** to represent this relationship?\n\n"
|
68 |
+
"**If not, follow these steps:**\n"
|
69 |
+
"1️⃣ Draw a **coordinate plane**:\n"
|
70 |
+
" - **x-axis → time (hours)**\n"
|
71 |
+
" - **y-axis → distance (miles)**\n"
|
72 |
+
"2️⃣ Plot these points:\n"
|
73 |
+
" - (0, 0)\n"
|
74 |
+
" - (0.5, 22.5)\n"
|
75 |
+
" - (1, 45)\n"
|
76 |
+
" - (2, 90)\n"
|
77 |
+
" - (3, 135)\n"
|
78 |
+
"3️⃣ Draw a straight line through these points.\n"
|
79 |
+
"4️⃣ What does the **slope of the line** tell you about Jessica’s driving rate?\n\n"
|
80 |
+
"✅ Does your graph correctly show a **linear relationship**?",
|
81 |
+
|
82 |
+
# Step 6: Final Reflection & Posing Questions
|
83 |
+
"### Final Reflection 💭\n"
|
84 |
+
"Great job! Now, take a moment to reflect:\n"
|
85 |
+
"1️⃣ Which representation helped you understand the relationship best? Why?\n"
|
86 |
+
"2️⃣ How do these representations show the **same proportional relationship** in different ways?\n"
|
87 |
+
"3️⃣ Can you apply this method to another real-world proportional relationship?\n\n"
|
88 |
+
"### New Challenge 🌟\n"
|
89 |
+
"Imagine Jessica increases her speed by **10 miles per hour**. How would this affect the bar model, number line, ratio table, and graph?\n\n"
|
90 |
+
"Try adjusting your models to reflect this change!",
|
91 |
+
|
92 |
+
# Summary of Objectives & Common Core Standards
|
93 |
+
"### Summary of Objectives 🎯\n"
|
94 |
+
"- You explored **four ways** to represent proportional relationships: Bar Model, Double Number Line, Ratio Table, and Graph.\n"
|
95 |
+
"- You understood how **time and distance** relate at a constant rate.\n"
|
96 |
+
"- You analyzed how different models show the **same mathematical pattern**.\n\n"
|
97 |
+
"### Common Core Math Standards 🏆\n"
|
98 |
+
"- **6.RP.A.1** - Understand the concept of a ratio.\n"
|
99 |
+
"- **6.RP.A.3a** - Use ratio reasoning to solve real-world problems.\n"
|
100 |
+
"- **7.RP.A.2** - Recognize proportional relationships.\n\n"
|
101 |
+
"✅ **Congratulations! You’ve completed this module.** 🚀"
|
102 |
+
]
|
103 |
+
|
104 |
+
# State tracking function
|
105 |
+
def guide_user(state):
|
106 |
+
"""Returns the next step based on user progress"""
|
107 |
+
state = int(state) + 1
|
108 |
+
if state >= len(PROMPTS):
|
109 |
+
return "✅ You have completed all steps! Great job!", str(state)
|
110 |
+
return PROMPTS[state], str(state)
|
111 |
+
|
112 |
+
# Gradio interface
|
113 |
+
with gr.Blocks() as app:
|
114 |
+
gr.Markdown("## Step-by-Step Guide: Representing Jessica's Driving Distance 🚗")
|
115 |
+
|
116 |
+
state = gr.State(value="0") # Tracks the user's progress
|
117 |
+
|
118 |
+
chatbot = gr.Chatbot(label="AI Guide", height=300, type="messages") # Fixed deprecation warning
|
119 |
+
user_input = gr.Textbox(label="Your Response (optional)", placeholder="Type here or click 'Next' to continue...")
|
120 |
+
|
121 |
+
next_btn = gr.Button("Next Step ➡️")
|
122 |
+
|
123 |
+
def update_chat(user_response, history, state):
|
124 |
+
"""Updates chat history and progresses to the next step"""
|
125 |
+
history.append({"role": "user", "content": user_response if user_response else ""})
|
126 |
+
next_message, new_state = guide_user(state)
|
127 |
+
history.append({"role": "assistant", "content": next_message})
|
128 |
+
return history, new_state
|
129 |
+
|
130 |
+
next_btn.click(update_chat, [user_input, chatbot, state], [chatbot, state])
|
131 |
+
|
132 |
+
app.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|