Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -32,11 +32,11 @@ def respond(
|
|
32 |
if val[1]:
|
33 |
messages.append({"role": "assistant", "content": val[1]})
|
34 |
|
35 |
-
print(f"{datetime.datetime.now()}::{{'role': 'user', 'content': val[0]}}->{{'role': 'user', 'content': val[1]}}")
|
36 |
|
37 |
# Adding the current user input
|
38 |
messages.append({"role": "user", "content": message})
|
39 |
-
|
40 |
response = ""
|
41 |
|
42 |
# Streaming the response from the API
|
@@ -50,8 +50,9 @@ def respond(
|
|
50 |
token = message.choices[0].delta.content
|
51 |
response += token
|
52 |
yield response
|
|
|
|
|
53 |
|
54 |
-
|
55 |
def encode_image(image_path):
|
56 |
with open(image_path, "rb") as image_file:
|
57 |
return base64.b64encode(image_file.read()).decode('utf-8')
|
|
|
32 |
if val[1]:
|
33 |
messages.append({"role": "assistant", "content": val[1]})
|
34 |
|
35 |
+
# print(f"{datetime.datetime.now()}::{{'role': 'user', 'content': val[0]}}->{{'role': 'user', 'content': val[1]}}")
|
36 |
|
37 |
# Adding the current user input
|
38 |
messages.append({"role": "user", "content": message})
|
39 |
+
|
40 |
response = ""
|
41 |
|
42 |
# Streaming the response from the API
|
|
|
50 |
token = message.choices[0].delta.content
|
51 |
response += token
|
52 |
yield response
|
53 |
+
|
54 |
+
print(f"{datetime.datetime,now()}::{messages[-1]}->{response}")
|
55 |
|
|
|
56 |
def encode_image(image_path):
|
57 |
with open(image_path, "rb") as image_file:
|
58 |
return base64.b64encode(image_file.read()).decode('utf-8')
|