removed conditions for the image since output will be text either way
Browse files
app.py
CHANGED
@@ -269,22 +269,33 @@ def bot_comms(message, history):
|
|
269 |
# # if mode == "chatting" or mode == "":
|
270 |
# # logger.debug("On chatting or no mode.\n\n")
|
271 |
# stream = generation(message, history)
|
272 |
-
# logger.debug(f"\n\nOn chat mode for bot_comms right now.\n\n")
|
273 |
-
for chunk in stream:
|
274 |
-
if chunk is not None and hasattr(chunk, 'choices') and chunk.choices:
|
275 |
-
delta_content = chunk.choices[0].delta.get("content", "")
|
276 |
-
if delta_content:
|
277 |
-
gpt_outputs.append(delta_content)
|
278 |
-
yield "".join(gpt_outputs)
|
279 |
|
280 |
-
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
# logger.debug("\n\nFound the chunk in stream for gpt-3.5\n\n")
|
283 |
# text = chunk.choices[0].delta.content
|
284 |
# if text:
|
285 |
# gpt_outputs.append(text)
|
286 |
# buffer += text
|
287 |
# yield "".join(gpt_outputs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
|
289 |
chat_input = gr.MultimodalTextbox(interactive=True, file_types=["images"], placeholder="Enter your question or upload an image.", show_label=False)
|
290 |
|
|
|
269 |
# # if mode == "chatting" or mode == "":
|
270 |
# # logger.debug("On chatting or no mode.\n\n")
|
271 |
# stream = generation(message, history)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
|
273 |
+
# elif hasattr(chunk, 'imague_url'):
|
274 |
+
# # Process Image Response
|
275 |
+
# image_url = chunk.image_url.get("url", "")
|
276 |
+
# gpt_outputs.append()
|
277 |
+
# if chunk is not None and hasattr(chunk, 'choices') and chunk.choices:
|
278 |
+
# delta_content = chunk.choices[0].delta.get("content", "")
|
279 |
+
# if delta_content:
|
280 |
+
# gpt_outputs.append(delta_content)
|
281 |
+
# yield "".join(gpt_outputs)
|
282 |
+
|
283 |
+
# else:
|
284 |
+
# logger.debug("Chunk does not contain 'choices' attribute or is None.")
|
285 |
# logger.debug("\n\nFound the chunk in stream for gpt-3.5\n\n")
|
286 |
# text = chunk.choices[0].delta.content
|
287 |
# if text:
|
288 |
# gpt_outputs.append(text)
|
289 |
# buffer += text
|
290 |
# yield "".join(gpt_outputs)
|
291 |
+
# logger.debug(f"\n\nOn chat mode for bot_comms right now.\n\n")
|
292 |
+
for chunk in stream:
|
293 |
+
if chunk.choices[0].delta.content is not None:
|
294 |
+
text = chunk.choices[0].delta.content
|
295 |
+
if text:
|
296 |
+
gpt_outputs.append(text)
|
297 |
+
buffer += text
|
298 |
+
yield "".join(gpt_outputs)
|
299 |
|
300 |
chat_input = gr.MultimodalTextbox(interactive=True, file_types=["images"], placeholder="Enter your question or upload an image.", show_label=False)
|
301 |
|