Spaces:
Sleeping
Sleeping
Update prompts/main_prompt.py
Browse files- prompts/main_prompt.py +24 -129
prompts/main_prompt.py
CHANGED
@@ -1,132 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
#
|
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 |
-
|
17 |
-
|
18 |
-
|
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()
|
|
|
1 |
+
### Welcome to Module 2: Solving a Ratio Problem Using Multiple Representations!
|
2 |
+
|
3 |
+
#### **Task:**
|
4 |
+
Jessica drives **90 miles in 2 hours**. If she drives at the same rate, how far does she travel in:
|
5 |
+
- **1 hour?**
|
6 |
+
- **½ hour?**
|
7 |
+
- **3 hours?**
|
8 |
+
|
9 |
+
To solve this, try using different representations:
|
10 |
+
- **Bar models**
|
11 |
+
- **Double number lines**
|
12 |
+
- **Ratio tables**
|
13 |
+
- **Graphs**
|
14 |
+
|
15 |
+
🔹 **Goal:** Don't just find the answer—**explain why**!
|
16 |
+
💬 I'll guide you step by step—let’s start with the **bar model**.
|
17 |
+
"""
|
18 |
import gradio as gr
|
19 |
+
from prompts.main_prompt import TASK_PROMPT # ✅ Correct import
|
20 |
|
21 |
+
# Function to start with the problem/task
|
22 |
+
def start_module():
|
23 |
+
return TASK_PROMPT # ✅ Ensures the module starts with the problem
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
# Hugging Face Interface
|
26 |
+
iface = gr.Interface(fn=start_module, inputs=[], outputs="text")
|
27 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|