eddiebee commited on
Commit
23703f2
·
verified ·
1 Parent(s): 0f11b93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -16
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: {level}\nExplanation:\n{explanation}\n\nChallenge:\n{challenge}"
48
  else:
49
- return f"Level: {level}\nExplanation:\n{explanation}"
50
 
51
  # Updated Gradio interface with challenge request option
52
- with gr.Blocks() as demo:
53
- gr.Markdown("## Adaptive Computer Science Tutor")
 
54
 
55
- # Inputs for user details and topic
56
- name = gr.Textbox(label="Your Name")
57
- experience = gr.Textbox(label="Describe your experience with programming.")
58
- goals = gr.Textbox(label="What are your learning goals?")
59
- topic = gr.Textbox(label="Topic you'd like to learn about")
60
- request_challenge = gr.Checkbox(label="Would you like a practice challenge?")
 
61
 
62
- # Output
63
- output = gr.Markdown(label="Tutor's Response", min_height=50)
64
-
65
- # Submit button
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()