Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,28 +44,29 @@ def tutor_interface(name, experience, goals, topic, request_challenge=False):
|
|
| 44 |
# Generate challenge if requested
|
| 45 |
if request_challenge:
|
| 46 |
challenge = generate_challenge(topic, level)
|
| 47 |
-
return f"Level
|
| 48 |
else:
|
| 49 |
-
return f"Level
|
| 50 |
|
| 51 |
# Updated Gradio interface with challenge request option
|
| 52 |
-
with gr.Blocks() as demo:
|
| 53 |
-
gr.Markdown("
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
submit_button = gr.Button("Get Started")
|
| 67 |
submit_button.click(tutor_interface, inputs=[name, experience, goals, topic, request_challenge], outputs=output)
|
| 68 |
|
| 69 |
-
# Launch the app
|
| 70 |
if __name__ == "__main__":
|
| 71 |
demo.launch()
|
|
|
|
| 44 |
# Generate challenge if requested
|
| 45 |
if request_challenge:
|
| 46 |
challenge = generate_challenge(topic, level)
|
| 47 |
+
return f"**Level:** {level}\n\n**Explanation:**\n{explanation}\n\n**Challenge:**\n{challenge}"
|
| 48 |
else:
|
| 49 |
+
return f"**Level:** {level}\n\n**Explanation:**\n{explanation}"
|
| 50 |
|
| 51 |
# Updated Gradio interface with challenge request option
|
| 52 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 53 |
+
gr.Markdown("# Adaptive Computer Science Tutor")
|
| 54 |
+
gr.Markdown("Welcome to your personalized Computer Science Tutor! This tutor adapts to your level and learning pace, offering explanations and practice challenges in areas like data structures, algorithms, and more.")
|
| 55 |
|
| 56 |
+
with gr.Row():
|
| 57 |
+
with gr.Column():
|
| 58 |
+
name = gr.Textbox(label="Your Name", placeholder="Enter your name")
|
| 59 |
+
experience = gr.Textbox(label="Describe your programming experience", placeholder="e.g., Beginner, 2 years Python")
|
| 60 |
+
with gr.Column():
|
| 61 |
+
goals = gr.Textbox(label="What are your learning goals?", placeholder="What do you want to achieve?")
|
| 62 |
+
topic = gr.Textbox(label="Topic you'd like to learn about", placeholder="e.g., Binary Search, Arrays")
|
| 63 |
|
| 64 |
+
request_challenge = gr.Checkbox(label="Include a practice challenge", value=False)
|
| 65 |
+
|
| 66 |
+
output = gr.Markdown(label="Tutor's Response", min_height=200)
|
| 67 |
+
|
| 68 |
+
submit_button = gr.Button("Get Started", variant="primary")
|
| 69 |
submit_button.click(tutor_interface, inputs=[name, experience, goals, topic, request_challenge], outputs=output)
|
| 70 |
|
|
|
|
| 71 |
if __name__ == "__main__":
|
| 72 |
demo.launch()
|