Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -78,7 +78,7 @@ def update_chat_history(user_id, role, content):
|
|
78 |
store_message_in_mongo(user_id, role, content)
|
79 |
|
80 |
def encode_local_image(image_path):
|
81 |
-
im = Image.
|
82 |
buffered = BytesIO()
|
83 |
im.save(buffered, format="PNG")
|
84 |
image_bytes = buffered.getvalue()
|
@@ -134,6 +134,7 @@ async def get_completion(event, user_id, prompt):
|
|
134 |
presence_penalty=0.9,
|
135 |
stream=True
|
136 |
)
|
|
|
137 |
for chunk in completion:
|
138 |
if chunk.choices[0].delta.content is not None:
|
139 |
message += chunk.choices[0].delta.content
|
@@ -211,7 +212,7 @@ def keep_alive():
|
|
211 |
temperature=0.1,
|
212 |
top_p=0.1,
|
213 |
)
|
214 |
-
print(request)
|
215 |
except Exception as e:
|
216 |
print(f"Keep-alive request failed: {e}")
|
217 |
time.sleep(1800)
|
|
|
78 |
store_message_in_mongo(user_id, role, content)
|
79 |
|
80 |
def encode_local_image(image_path):
|
81 |
+
im = Image.open(image_path)
|
82 |
buffered = BytesIO()
|
83 |
im.save(buffered, format="PNG")
|
84 |
image_bytes = buffered.getvalue()
|
|
|
134 |
presence_penalty=0.9,
|
135 |
stream=True
|
136 |
)
|
137 |
+
message = ""
|
138 |
for chunk in completion:
|
139 |
if chunk.choices[0].delta.content is not None:
|
140 |
message += chunk.choices[0].delta.content
|
|
|
212 |
temperature=0.1,
|
213 |
top_p=0.1,
|
214 |
)
|
215 |
+
print(request.choices[0].message.content)
|
216 |
except Exception as e:
|
217 |
print(f"Keep-alive request failed: {e}")
|
218 |
time.sleep(1800)
|