Spaces:
Running
Running
SnJForever
commited on
Commit
•
964093a
1
Parent(s):
26498cf
Update app.py
Browse files
app.py
CHANGED
@@ -87,7 +87,7 @@ def submit_message(type_select,user_token, prompt, prompt_template, temperature,
|
|
87 |
print("image result ",response)
|
88 |
image_url = response['data'][0]['url']
|
89 |
history.append(prompt_msg)
|
90 |
-
history.append({ "role": "
|
91 |
|
92 |
state['total_tokens'] += 0
|
93 |
|
@@ -99,8 +99,16 @@ def submit_message(type_select,user_token, prompt, prompt_template, temperature,
|
|
99 |
})
|
100 |
|
101 |
total_tokens_used_msg = f"Total tokens used: {state['total_tokens']}"
|
102 |
-
chat_messages = [(history[i]['content'], history[i+1]['content']) for i in range(0, len(history)-1, 2)]
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
return '', chat_messages, total_tokens_used_msg, state
|
105 |
|
106 |
def clear_conversation():
|
|
|
87 |
print("image result ",response)
|
88 |
image_url = response['data'][0]['url']
|
89 |
history.append(prompt_msg)
|
90 |
+
history.append({ "role": "image", "content": image_url })
|
91 |
|
92 |
state['total_tokens'] += 0
|
93 |
|
|
|
99 |
})
|
100 |
|
101 |
total_tokens_used_msg = f"Total tokens used: {state['total_tokens']}"
|
|
|
102 |
|
103 |
+
chat_messages = [(history[i]['content'], history[i+1]['content']) for i in range(0, len(history)-1, 2)]
|
104 |
+
print(1,chat_messages)
|
105 |
+
chat_messages=[]
|
106 |
+
for i in range(0, len(history)-1, 2):
|
107 |
+
if(history[i]['role']=='image'):
|
108 |
+
chat_messages.append(((history[i]['content'],), None))
|
109 |
+
else:
|
110 |
+
chat_messages.append(history[i]['content'])
|
111 |
+
print(2,chat_messages)
|
112 |
return '', chat_messages, total_tokens_used_msg, state
|
113 |
|
114 |
def clear_conversation():
|