Spaces:
Runtime error
Runtime error
Owen Wang
commited on
Commit
·
83af9fd
1
Parent(s):
6b2d71e
add the ideas
Browse files
app.py
CHANGED
|
@@ -117,28 +117,32 @@ def generate_ideas(metadatas, interests):
|
|
| 117 |
prompt = f"""
|
| 118 |
We've created a curriculum for the student:
|
| 119 |
{summary}
|
| 120 |
-
The student has
|
| 121 |
-
What are 5 ambitious projects the student could do after they've learned the skills from this curriculum?
|
|
|
|
| 122 |
"""
|
| 123 |
response = query_openai(prompt)
|
| 124 |
-
|
| 125 |
|
| 126 |
def generate_application(metadata, interests):
|
| 127 |
prompt = f"""
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
Don't repeat an example of a project if you've used it for a previous lesson.
|
| 133 |
-
Sound like you're naturally explaining the lesson in person. Don't start with a header, etc.
|
| 134 |
"""
|
| 135 |
response = query_openai(prompt)
|
| 136 |
return response
|
| 137 |
|
| 138 |
-
def format_metadata(metadata, interests):
|
| 139 |
print(metadata)
|
| 140 |
application = generate_application(metadata, interests)
|
| 141 |
-
return f"
|
| 142 |
|
| 143 |
def filtered_metadatas(lessons):
|
| 144 |
metadatas = [lesson.matches[0].metadata for lesson in lessons]
|
|
@@ -149,10 +153,10 @@ def filtered_metadatas(lessons):
|
|
| 149 |
st.set_page_config(layout="centered")
|
| 150 |
st.title("Discover Prequel")
|
| 151 |
st.markdown("Connecting learning to real-world experiences and personal passions makes education more engaging, meaningful, and applicable.\n\nUse this tool to generate a list of [Prequel](https://joinprequel.com/)'s life skill workshops relevant to each student's unique interests and goals.")
|
| 152 |
-
skills = st.text_input("""What skills would the student like to learn? List up to 3.
|
| 153 |
|
| 154 |
_Examples: public speaking, business, time management, technology_""")
|
| 155 |
-
interests = st.text_input("""What
|
| 156 |
|
| 157 |
_Examples: animals, video games, grow on social media_""")
|
| 158 |
submit_button = st.button("Generate curriculum")
|
|
@@ -169,12 +173,19 @@ if submit_button:
|
|
| 169 |
lessons_metadata = filtered_metadatas(lessons)
|
| 170 |
|
| 171 |
status.text("Harvesting the seeds of wisdom...")
|
| 172 |
-
generate_ideas(lessons_metadata, interests)
|
| 173 |
|
| 174 |
status.text("Building a bridge from your dreams to reality... just one more moment!")
|
| 175 |
-
lesson_text = "\n\n".join([format_metadata(metadata, interests) for metadata in lessons_metadata])
|
|
|
|
| 176 |
status.empty()
|
| 177 |
-
st.markdown(f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
else:
|
| 179 |
status.text("The Wheel of Education spun out of control! Care to give it another whirl? Click 'Generate curriculum' again")
|
| 180 |
|
|
|
|
| 117 |
prompt = f"""
|
| 118 |
We've created a curriculum for the student:
|
| 119 |
{summary}
|
| 120 |
+
The student has interests in \"{interests}\".
|
| 121 |
+
What are 5 ambitious projects related to the interests that the student could do after they've learned the skills from this curriculum?
|
| 122 |
+
The output should be a markdown list of the projects and nothing else.
|
| 123 |
"""
|
| 124 |
response = query_openai(prompt)
|
| 125 |
+
return response
|
| 126 |
|
| 127 |
def generate_application(metadata, interests):
|
| 128 |
prompt = f"""
|
| 129 |
+
You are now writing a description for the lesson titled \"{metadata['title']}\".
|
| 130 |
+
This description comes after the title so you don't have to mention the title explicitly.
|
| 131 |
+
Don't repeat the same sentence structures if you've used it for a previous lesson.
|
| 132 |
+
Sound like you're naturally explaining the lesson in person.
|
| 133 |
+
Describe the lesson and its outcome in one sentence objectively.
|
| 134 |
+
Next, in one concise sentence, explore possible personal growth outcomes that combine their previously listed interests with this lesson.
|
| 135 |
+
The sentence should implicitly help the student to feel inspired to connect with the lesson.
|
| 136 |
+
It should not explicitly use the words \"{interests}\" and instead provide as an example one of the previously described ambitious projects that's relevant to this lesson.
|
| 137 |
Don't repeat an example of a project if you've used it for a previous lesson.
|
|
|
|
| 138 |
"""
|
| 139 |
response = query_openai(prompt)
|
| 140 |
return response
|
| 141 |
|
| 142 |
+
def format_metadata(metadata, interests, i):
|
| 143 |
print(metadata)
|
| 144 |
application = generate_application(metadata, interests)
|
| 145 |
+
return f"Lesson {i + 1}: [{metadata['title']}]({metadata['slides']})\n\n{application}"
|
| 146 |
|
| 147 |
def filtered_metadatas(lessons):
|
| 148 |
metadatas = [lesson.matches[0].metadata for lesson in lessons]
|
|
|
|
| 153 |
st.set_page_config(layout="centered")
|
| 154 |
st.title("Discover Prequel")
|
| 155 |
st.markdown("Connecting learning to real-world experiences and personal passions makes education more engaging, meaningful, and applicable.\n\nUse this tool to generate a list of [Prequel](https://joinprequel.com/)'s life skill workshops relevant to each student's unique interests and goals.")
|
| 156 |
+
skills = st.text_input("""What life skills would the student like to learn? List up to 3.
|
| 157 |
|
| 158 |
_Examples: public speaking, business, time management, technology_""")
|
| 159 |
+
interests = st.text_input("""What are some interests or goals the student has? List up to 3.
|
| 160 |
|
| 161 |
_Examples: animals, video games, grow on social media_""")
|
| 162 |
submit_button = st.button("Generate curriculum")
|
|
|
|
| 173 |
lessons_metadata = filtered_metadatas(lessons)
|
| 174 |
|
| 175 |
status.text("Harvesting the seeds of wisdom...")
|
| 176 |
+
ideas = generate_ideas(lessons_metadata, interests)
|
| 177 |
|
| 178 |
status.text("Building a bridge from your dreams to reality... just one more moment!")
|
| 179 |
+
lesson_text = "\n\n".join([format_metadata(metadata, interests, i) for i, metadata in enumerate(lessons_metadata)])
|
| 180 |
+
|
| 181 |
status.empty()
|
| 182 |
+
st.markdown(f"""
|
| 183 |
+
\n\n## Your personalized learning playlist\n\n
|
| 184 |
+
*Your student could work on the following projects:*\n\n
|
| 185 |
+
{ideas}\n\n
|
| 186 |
+
*The following lesson plan will help with those projects:*\n\n
|
| 187 |
+
{lesson_text}
|
| 188 |
+
""")
|
| 189 |
else:
|
| 190 |
status.text("The Wheel of Education spun out of control! Care to give it another whirl? Click 'Generate curriculum' again")
|
| 191 |
|