omarash2016 commited on
Commit
35be527
·
verified ·
1 Parent(s): dab4027

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -2
app.py CHANGED
@@ -133,9 +133,14 @@ with gr.Blocks(title="AI Python Tutor", theme=theme, fill_height=True) as demo:
133
  with gr.Row(equal_height=True):
134
  # Left Column: Chat & Input
135
  with gr.Column(scale=3, variant="panel"):
 
 
 
 
 
136
  chatbot = gr.Chatbot(
137
  height=600,
138
- label="Interactive Session",
139
  type="messages",
140
  bubble_full_width=False,
141
  show_copy_button=True,
@@ -165,7 +170,8 @@ with gr.Blocks(title="AI Python Tutor", theme=theme, fill_height=True) as demo:
165
  )
166
 
167
  # Right Column: Resources Dashboard (Tabbed)
168
- with gr.Column(scale=2):
 
169
  gr.Markdown("### 🎒 Learning Dashboard")
170
 
171
  # Tabbed interface for cleaner look
@@ -202,6 +208,23 @@ with gr.Blocks(title="AI Python Tutor", theme=theme, fill_height=True) as demo:
202
 
203
  yield history, "", video_text, article_text, quiz_text
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  # Actions
206
  submit_btn.click(
207
  respond,
 
133
  with gr.Row(equal_height=True):
134
  # Left Column: Chat & Input
135
  with gr.Column(scale=3, variant="panel"):
136
+ # Custom Header with Focus Mode Button
137
+ with gr.Row():
138
+ gr.Markdown("### 💬 Interactive Session")
139
+ fullscreen_btn = gr.Button("⛶ Focus Mode", size="sm", variant="secondary", scale=0, min_width=120)
140
+
141
  chatbot = gr.Chatbot(
142
  height=600,
143
+ show_label=False, # Removed built-in label to match custom header
144
  type="messages",
145
  bubble_full_width=False,
146
  show_copy_button=True,
 
170
  )
171
 
172
  # Right Column: Resources Dashboard (Tabbed)
173
+ # We assign 'right_col' so we can toggle its visibility
174
+ with gr.Column(scale=2) as right_col:
175
  gr.Markdown("### 🎒 Learning Dashboard")
176
 
177
  # Tabbed interface for cleaner look
 
208
 
209
  yield history, "", video_text, article_text, quiz_text
210
 
211
+ # --- Focus Mode Logic ---
212
+ is_fullscreen = gr.State(False)
213
+
214
+ def toggle_fullscreen(current_state):
215
+ new_state = not current_state
216
+ # If new_state is True (Fullscreen), hide right col.
217
+ # If False (Normal), show right col.
218
+ right_col_update = gr.Column(visible=not new_state)
219
+ btn_text = "↩ Exit Focus" if new_state else "⛶ Focus Mode"
220
+ return new_state, right_col_update, btn_text
221
+
222
+ fullscreen_btn.click(
223
+ toggle_fullscreen,
224
+ inputs=[is_fullscreen],
225
+ outputs=[is_fullscreen, right_col, fullscreen_btn]
226
+ )
227
+
228
  # Actions
229
  submit_btn.click(
230
  respond,