Avinash17 commited on
Commit
f82b2d9
·
verified ·
1 Parent(s): 2f44539

final fix

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -57,16 +57,19 @@ def respond(
57
 
58
  with gr.Blocks() as demo:
59
  gr.Markdown("# 🧮 Llama Math Tutor")
60
- # Create a Chatbot component
 
61
  chatbot = gr.Chatbot(
62
  label="Math Tutor Chat",
63
- placeholder="Type your math question here..."
 
 
64
  )
65
- # ChatInterface using the Chatbot and messages format
66
  gr.ChatInterface(
67
  fn=respond,
68
- chatbot=chatbot,
69
- type="messages",
70
  additional_inputs=[
71
  gr.Textbox(
72
  value="You are an expert math tutor. Provide clear, step-by-step solutions.",
@@ -80,5 +83,4 @@ with gr.Blocks() as demo:
80
  description="Ask any math question & get step-by-step answers."
81
  )
82
 
83
- if __name__ == "__main__":
84
- demo.launch(server_name="0.0.0.0", server_port=7860)
 
57
 
58
  with gr.Blocks() as demo:
59
  gr.Markdown("# 🧮 Llama Math Tutor")
60
+
61
+ # Make sure the Chatbot starts with a list[dict] (not tuples)
62
  chatbot = gr.Chatbot(
63
  label="Math Tutor Chat",
64
+ placeholder="Type your math question here",
65
+ type="messages",
66
+ value=[] # <— start with an empty list of {role,content} dicts
67
  )
68
+
69
  gr.ChatInterface(
70
  fn=respond,
71
+ chatbot=chatbot, # pass in your Chatbot instance
72
+ type="messages", # enforce messages format
73
  additional_inputs=[
74
  gr.Textbox(
75
  value="You are an expert math tutor. Provide clear, step-by-step solutions.",
 
83
  description="Ask any math question & get step-by-step answers."
84
  )
85
 
86
+ demo.launch(server_name="0.0.0.0", server_port=7860)