newtechdevng commited on
Commit
24acbfe
·
verified ·
1 Parent(s): 5dafbcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -47,9 +47,8 @@ def solve(question, class_level, history):
47
  answer = reply.split("<|im_start|>assistant\n")[-1]
48
  answer = answer.replace("<|im_end|>", "").strip()
49
 
50
- # ✅ Gradio 6 format — dict with role and content
51
- history.append({"role": "user", "content": question})
52
- history.append({"role": "assistant", "content": answer})
53
  return history, ""
54
 
55
  with gr.Blocks(title="Math Tutor Class 6-10") as app:
@@ -60,8 +59,7 @@ with gr.Blocks(title="Math Tutor Class 6-10") as app:
60
  choices=["6", "7", "8", "9", "10"],
61
  value="8", label="Select Class", scale=1
62
  )
63
- # ✅ Gradio 6 chatbot type="messages"
64
- chatbot = gr.Chatbot(label="Math Solutions", height=450, type="messages")
65
  with gr.Row():
66
  question = gr.Textbox(
67
  label="Your Question",
 
47
  answer = reply.split("<|im_start|>assistant\n")[-1]
48
  answer = answer.replace("<|im_end|>", "").strip()
49
 
50
+ # ✅ Simple tuple format — works across all Gradio versions
51
+ history.append((question, answer))
 
52
  return history, ""
53
 
54
  with gr.Blocks(title="Math Tutor Class 6-10") as app:
 
59
  choices=["6", "7", "8", "9", "10"],
60
  value="8", label="Select Class", scale=1
61
  )
62
+ chatbot = gr.Chatbot(label="Math Solutions", height=450)
 
63
  with gr.Row():
64
  question = gr.Textbox(
65
  label="Your Question",