Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -41,13 +41,19 @@ with open('chatbots.txt', 'r') as file:
|
|
41 |
def clear_chat(state):
|
42 |
# Reset state including the chatbot order
|
43 |
state = {} if state is not None else state
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
# Shuffle and reinitialize chatbots in the state
|
45 |
-
bot_names = list(chatbots.keys())
|
46 |
random.shuffle(bot_names)
|
47 |
state['last_bots'] = [bot_names[0], bot_names[1]]
|
|
|
48 |
# Reset other components
|
49 |
-
return state,
|
50 |
-
|
51 |
global_elo_ratings=None
|
52 |
|
53 |
from datasets import load_dataset,DatasetDict,Dataset
|
|
|
41 |
def clear_chat(state):
|
42 |
# Reset state including the chatbot order
|
43 |
state = {} if state is not None else state
|
44 |
+
|
45 |
+
# Initialize the collection object
|
46 |
+
collection = init_database()
|
47 |
+
|
48 |
+
# Get the list of chatbot names
|
49 |
+
bot_names = list(get_user_elo_ratings(collection).keys())
|
50 |
+
|
51 |
# Shuffle and reinitialize chatbots in the state
|
|
|
52 |
random.shuffle(bot_names)
|
53 |
state['last_bots'] = [bot_names[0], bot_names[1]]
|
54 |
+
|
55 |
# Reset other components
|
56 |
+
return state, [], [], gr.Button.update(interactive=False), gr.Button.update(interactive=False), gr.Textbox.update(value='', interactive=True), gr.Button.update(interactive=True)
|
|
|
57 |
global_elo_ratings=None
|
58 |
|
59 |
from datasets import load_dataset,DatasetDict,Dataset
|