decodingdatascience commited on
Commit
8fc0dad
·
verified ·
1 Parent(s): fd43762

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -12
app.py CHANGED
@@ -100,7 +100,7 @@ def respond(user_text, chat_history, messages):
100
 
101
 
102
  # -----------------------------
103
- # Gradio UI (Upgraded)
104
  # -----------------------------
105
 
106
  FAQ_QUESTIONS = [
@@ -119,7 +119,6 @@ def set_question(q):
119
  def clear_all():
120
  return [], init_messages(), ""
121
 
122
- # Updated logo URL (RAW link)
123
  LOGO_URL = "https://raw.githubusercontent.com/Decoding-Data-Science/nov25/main/logo_python.png"
124
 
125
  css = """
@@ -158,7 +157,6 @@ css = """
158
  }
159
  """
160
 
161
- # Gradio 6+ expects css/theme passed to launch()
162
  with gr.Blocks(elem_id="app_container") as demo:
163
  # Header Row
164
  with gr.Row():
@@ -187,7 +185,7 @@ with gr.Blocks(elem_id="app_container") as demo:
187
 
188
  gr.Markdown("---")
189
 
190
- # State (unchanged logic)
191
  state = gr.State(init_messages())
192
 
193
  # Two-column layout
@@ -196,12 +194,8 @@ with gr.Blocks(elem_id="app_container") as demo:
196
  with gr.Column(scale=4, min_width=320):
197
  with gr.Group(elem_classes=["faq-box"]):
198
  gr.Markdown("### FAQ — Most Asked Python Questions")
 
199
 
200
- gr.Markdown(
201
- "Click a question to auto-fill it, then press **Enter** or click **Send**."
202
- )
203
-
204
- # Buttons for FAQ
205
  faq_buttons = []
206
  for q in FAQ_QUESTIONS:
207
  b = gr.Button(q, elem_classes=["faq-btn"])
@@ -224,7 +218,6 @@ with gr.Blocks(elem_id="app_container") as demo:
224
  with gr.Column(scale=8, min_width=520):
225
  chatbot = gr.Chatbot(
226
  height=520,
227
- bubble_full_width=False,
228
  label="Conversation"
229
  )
230
 
@@ -264,7 +257,7 @@ with gr.Blocks(elem_id="app_container") as demo:
264
  outputs=msg
265
  )
266
 
267
- # Submit logic (unchanged)
268
  msg.submit(
269
  respond,
270
  inputs=[msg, chatbot, state],
@@ -284,7 +277,6 @@ with gr.Blocks(elem_id="app_container") as demo:
284
  outputs=[chatbot, state, msg]
285
  )
286
 
287
- # Pass theme/css here for Gradio 6+
288
  demo.launch(
289
  debug=False,
290
  theme=gr.themes.Soft(),
 
100
 
101
 
102
  # -----------------------------
103
+ # Gradio UI
104
  # -----------------------------
105
 
106
  FAQ_QUESTIONS = [
 
119
  def clear_all():
120
  return [], init_messages(), ""
121
 
 
122
  LOGO_URL = "https://raw.githubusercontent.com/Decoding-Data-Science/nov25/main/logo_python.png"
123
 
124
  css = """
 
157
  }
158
  """
159
 
 
160
  with gr.Blocks(elem_id="app_container") as demo:
161
  # Header Row
162
  with gr.Row():
 
185
 
186
  gr.Markdown("---")
187
 
188
+ # State
189
  state = gr.State(init_messages())
190
 
191
  # Two-column layout
 
194
  with gr.Column(scale=4, min_width=320):
195
  with gr.Group(elem_classes=["faq-box"]):
196
  gr.Markdown("### FAQ — Most Asked Python Questions")
197
+ gr.Markdown("Click a question to auto-fill it, then press **Enter** or click **Send**.")
198
 
 
 
 
 
 
199
  faq_buttons = []
200
  for q in FAQ_QUESTIONS:
201
  b = gr.Button(q, elem_classes=["faq-btn"])
 
218
  with gr.Column(scale=8, min_width=520):
219
  chatbot = gr.Chatbot(
220
  height=520,
 
221
  label="Conversation"
222
  )
223
 
 
257
  outputs=msg
258
  )
259
 
260
+ # Submit logic
261
  msg.submit(
262
  respond,
263
  inputs=[msg, chatbot, state],
 
277
  outputs=[chatbot, state, msg]
278
  )
279
 
 
280
  demo.launch(
281
  debug=False,
282
  theme=gr.themes.Soft(),