Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,13 +30,12 @@ def write_elo_ratings(elo_ratings):
|
|
30 |
def format_alpaca_prompt(state):
|
31 |
alpaca_prompt = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
|
32 |
for message in state["history"]:
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
alpaca_prompt += j+ message['content']+"\n\n"
|
40 |
return alpaca_prompt+"### Response:\n"
|
41 |
def get_bot_response(url, prompt,state):
|
42 |
alpaca_prompt = format_alpaca_prompt(state)
|
@@ -108,7 +107,7 @@ def user_ask(state, chatbot1, chatbot2, textbox):
|
|
108 |
# Update chat history in state
|
109 |
if "history" not in state:
|
110 |
state.update({'history': []})
|
111 |
-
state["history"].
|
112 |
{"role": "bot1", "content": bot1_response},
|
113 |
{"role": "bot2", "content": bot2_response}
|
114 |
])
|
|
|
30 |
def format_alpaca_prompt(state):
|
31 |
alpaca_prompt = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
|
32 |
for message in state["history"]:
|
33 |
+
j=""
|
34 |
+
if message['role']=='user':
|
35 |
+
j="### Instruction:\n"
|
36 |
+
else:
|
37 |
+
j="### Response:\n"
|
38 |
+
alpaca_prompt += j+ message['content']+"\n\n"
|
|
|
39 |
return alpaca_prompt+"### Response:\n"
|
40 |
def get_bot_response(url, prompt,state):
|
41 |
alpaca_prompt = format_alpaca_prompt(state)
|
|
|
107 |
# Update chat history in state
|
108 |
if "history" not in state:
|
109 |
state.update({'history': []})
|
110 |
+
state["history"].extend([
|
111 |
{"role": "bot1", "content": bot1_response},
|
112 |
{"role": "bot2", "content": bot2_response}
|
113 |
])
|