david167 commited on
Commit
671b58c
·
1 Parent(s): 9a93733

Fix Gradio compatibility: update to new message format and remove deprecated parameters

Browse files
Files changed (1) hide show
  1. gradio_app.py +3 -6
gradio_app.py CHANGED
@@ -173,7 +173,7 @@ def chat_with_model(message, history, num_questions, difficulty, temperature):
173
  return history, ""
174
 
175
  # Add user message to history
176
- history.append([message, None])
177
 
178
  # Generate questions
179
  questions = model_manager.generate_questions(
@@ -192,7 +192,7 @@ def chat_with_model(message, history, num_questions, difficulty, temperature):
192
  response = "I couldn't generate questions from that statement. Please try rephrasing it."
193
 
194
  # Add bot response to history
195
- history[-1][1] = response
196
 
197
  return history, ""
198
 
@@ -250,7 +250,7 @@ with gr.Blocks(css=css, title="Question Generation AI", theme=gr.themes.Soft())
250
  label="Chat",
251
  show_label=False,
252
  avatar_images=(None, None),
253
- bubble_full_width=False,
254
  show_share_button=False
255
  )
256
 
@@ -333,7 +333,4 @@ if __name__ == "__main__":
333
  server_port=7860,
334
  share=False,
335
  show_error=True,
336
- show_tips=False,
337
- enable_queue=True,
338
- max_threads=10
339
  )
 
173
  return history, ""
174
 
175
  # Add user message to history
176
+ # Use new message format instead
177
 
178
  # Generate questions
179
  questions = model_manager.generate_questions(
 
192
  response = "I couldn't generate questions from that statement. Please try rephrasing it."
193
 
194
  # Add bot response to history
195
+ history.append({"role": "user", "content": message}); history.append({"role": "assistant", "content": response})
196
 
197
  return history, ""
198
 
 
250
  label="Chat",
251
  show_label=False,
252
  avatar_images=(None, None),
253
+ type="messages", # Use new message format
254
  show_share_button=False
255
  )
256
 
 
333
  server_port=7860,
334
  share=False,
335
  show_error=True,
 
 
 
336
  )