keerthuAi commited on
Commit
c176284
ยท
verified ยท
1 Parent(s): 1ba70c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -1
app.py CHANGED
@@ -64,4 +64,40 @@ def prev_q():
64
  global question_index
65
  if history:
66
  question_index = history.pop()
67
- return
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  global question_index
65
  if history:
66
  question_index = history.pop()
67
+ return show_question()
68
+
69
+ # ๐ŸŽจ Gradio UI
70
+ with gr.Blocks(theme=gr.themes.Base(primary_hue="green", secondary_hue="pink")) as app:
71
+ gr.Markdown("## ๐Ÿ Python Fun Quiz Game for Kids ๐ŸŽฎ")
72
+ with gr.Row():
73
+ score_box = gr.Textbox(label="๐Ÿ“Š Your Score", interactive=False, value="โญ Score: 0")
74
+ hint_box = gr.Textbox(label="๐Ÿ’ก Hint", interactive=False)
75
+ code_display = gr.Textbox(label="๐Ÿง  What will this Python code print?", lines=2, interactive=False)
76
+ options = gr.Radio(choices=[], label="๐Ÿง Choose your answer")
77
+ result = gr.Textbox(label="๐ŸŽฏ Result", interactive=False)
78
+
79
+ with gr.Row():
80
+ btn_check = gr.Button("โœ… Check Answer")
81
+ btn_hint = gr.Button("๐Ÿ’ก Get Hint")
82
+ btn_skip = gr.Button("โญ๏ธ Skip")
83
+ btn_back = gr.Button("โช Back")
84
+
85
+ btn_check.click(fn=check_answer, inputs=options, outputs=[result, score_box])
86
+ btn_hint.click(fn=get_hint, outputs=hint_box)
87
+ btn_skip.click(fn=skip_question, outputs=[code_display, options, result, score_box])
88
+ btn_back.click(fn=prev_q, outputs=[code_display, options, result, score_box])
89
+
90
+ # Load first question
91
+ app.load(show_question, outputs=[code_display, options, result, score_box])
92
+
93
+ gr.Markdown("---")
94
+ gr.Markdown("## ๐ŸŒŸ Coming Soon: Unique Games")
95
+ gr.Markdown("""
96
+ - ๐Ÿ”ค **Python Word Scramble**: Rearrange jumbled Python keywords
97
+ - ๐ŸŽฒ **Code Dice**: Roll a die to get random challenges
98
+ - ๐Ÿงฉ **Puzzle Blocks**: Drag code blocks to form a working program
99
+ - ๐Ÿงšโ€โ™€๏ธ **Code Fairy Tales**: Read stories and guess what the code will do
100
+ """)
101
+
102
+ app.launch()
103
+