Rulga commited on
Commit
74d5dc1
·
1 Parent(s): cec57f0

Initialize chat evaluator and create state for evaluator in the interface

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -994,6 +994,9 @@ def initialize_chat_evaluator():
994
  # Initialize HF client with token at startup
995
  selected_model, saved_system_prompt = initialize_app()
996
 
 
 
 
997
  # Create interface
998
  with gr.Blocks(css="""
999
  .table-container {
@@ -1006,6 +1009,9 @@ with gr.Blocks(css="""
1006
  """Clear conversation and save history before clearing"""
1007
  return [], None # Just return empty values
1008
 
 
 
 
1009
  with gr.Tabs():
1010
  with gr.Tab("Chat"):
1011
  gr.Markdown("# ⚖️ Status Law Assistant")
@@ -1397,7 +1403,7 @@ with gr.Blocks(css="""
1397
  # Обработчик для удаления чата
1398
  delete_btn.click(
1399
  fn=delete_conversation,
1400
- inputs=[selected_conversation, chat_evaluator], # Используем созданный ранее объект chat_evaluator
1401
  outputs=[delete_status]
1402
  )
1403
 
 
994
  # Initialize HF client with token at startup
995
  selected_model, saved_system_prompt = initialize_app()
996
 
997
+ # Initialize evaluator before creating interface
998
+ chat_evaluator = initialize_chat_evaluator()
999
+
1000
  # Create interface
1001
  with gr.Blocks(css="""
1002
  .table-container {
 
1009
  """Clear conversation and save history before clearing"""
1010
  return [], None # Just return empty values
1011
 
1012
+ # Create State for evaluator
1013
+ evaluator_state = gr.State(value=chat_evaluator)
1014
+
1015
  with gr.Tabs():
1016
  with gr.Tab("Chat"):
1017
  gr.Markdown("# ⚖️ Status Law Assistant")
 
1403
  # Обработчик для удаления чата
1404
  delete_btn.click(
1405
  fn=delete_conversation,
1406
+ inputs=[selected_conversation, evaluator_state],
1407
  outputs=[delete_status]
1408
  )
1409