Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -239,6 +239,38 @@ example_placeholders = {}
|
|
| 239 |
|
| 240 |
def display_python_parts():
|
| 241 |
st.title("Python Interactive Learning Platform")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
for part, content in python_parts.items():
|
| 243 |
with st.expander(f"{content['emoji']} {part} - {content['details']}", expanded=False):
|
| 244 |
if st.button(f"Show Example for {part}", key=f"example_{part}"):
|
|
|
|
| 239 |
|
| 240 |
def display_python_parts():
|
| 241 |
st.title("Python Interactive Learning Platform")
|
| 242 |
+
|
| 243 |
+
for part, content in python_parts.items():
|
| 244 |
+
with st.expander(f"{content['emoji']} {part} - {content['details']}", expanded=False):
|
| 245 |
+
if st.button(f"Show Example for {part}", key=f"example_{part}"):
|
| 246 |
+
example = "Python script example with mock example inputs for " + part
|
| 247 |
+
example_placeholders[part] = example
|
| 248 |
+
st.code(example_placeholders[part], language="python")
|
| 249 |
+
response = chat_with_model(f'Create detailed advanced python script code examples for: {content["details"]}', part)
|
| 250 |
+
response_placeholders[part] = response
|
| 251 |
+
with st.expander(f"Example Output for {part}", expanded=True):
|
| 252 |
+
st.markdown(f"{content['emoji']} **{part} Example**")
|
| 253 |
+
st.markdown(response_placeholders[part])
|
| 254 |
+
|
| 255 |
+
if st.button(f"Take Quiz on {part}", key=f"quiz_{part}"):
|
| 256 |
+
quiz = "Python script quiz example with mock example inputs for " + part
|
| 257 |
+
response = chat_with_model(quiz, part)
|
| 258 |
+
response_placeholders[part] = response
|
| 259 |
+
with st.expander(f"Quiz for {part}", expanded=True):
|
| 260 |
+
st.markdown(f"{content['emoji']} **{part} Quiz**")
|
| 261 |
+
st.markdown(response_placeholders[part])
|
| 262 |
+
|
| 263 |
+
prompt = f"Learn about advanced coding examples using mock example inputs for {content['details']}"
|
| 264 |
+
if st.button(f"Explore {part}", key=part):
|
| 265 |
+
response = chat_with_model(prompt, part)
|
| 266 |
+
response_placeholders[part] = response
|
| 267 |
+
with st.expander(f"Details for {part}", expanded=True):
|
| 268 |
+
st.markdown(f"{content['emoji']} **{part} Details**")
|
| 269 |
+
st.markdown(response_placeholders[part])
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
def display_python_parts_old():
|
| 273 |
+
st.title("Python Interactive Learning Platform")
|
| 274 |
for part, content in python_parts.items():
|
| 275 |
with st.expander(f"{content['emoji']} {part} - {content['details']}", expanded=False):
|
| 276 |
if st.button(f"Show Example for {part}", key=f"example_{part}"):
|