Spaces:
Running
on
Zero
Running
on
Zero
fix
Browse files- app_dialogue.py +12 -5
app_dialogue.py
CHANGED
|
@@ -261,12 +261,20 @@ def flag_chat(
|
|
| 261 |
):
|
| 262 |
images = []
|
| 263 |
conversations = []
|
|
|
|
| 264 |
for ex in chat_history:
|
| 265 |
if isinstance(ex[0], dict):
|
| 266 |
images.append(ex[0]["file"])
|
| 267 |
-
|
| 268 |
else:
|
| 269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
dope_dataset_writer.flag(
|
| 271 |
flag_data=[
|
| 272 |
model_selector,
|
|
@@ -354,7 +362,6 @@ problematic_dataset_writer = gr.HuggingFaceDatasetSaver(
|
|
| 354 |
# The second syntax allows inputting an arbitrary number of images.""")
|
| 355 |
|
| 356 |
image_fake = gr.Image(visible=False)
|
| 357 |
-
text_fake = gr.Textbox(visible=False)
|
| 358 |
|
| 359 |
with gr.Blocks(
|
| 360 |
fill_height=True,
|
|
@@ -434,7 +441,7 @@ with gr.Blocks(
|
|
| 434 |
[
|
| 435 |
model_selector,
|
| 436 |
image_fake,
|
| 437 |
-
|
| 438 |
decoding_strategy,
|
| 439 |
temperature,
|
| 440 |
max_new_tokens,
|
|
@@ -462,7 +469,7 @@ with gr.Blocks(
|
|
| 462 |
[
|
| 463 |
model_selector,
|
| 464 |
image_fake,
|
| 465 |
-
|
| 466 |
decoding_strategy,
|
| 467 |
temperature,
|
| 468 |
max_new_tokens,
|
|
|
|
| 261 |
):
|
| 262 |
images = []
|
| 263 |
conversations = []
|
| 264 |
+
prev_ex_is_image = False
|
| 265 |
for ex in chat_history:
|
| 266 |
if isinstance(ex[0], dict):
|
| 267 |
images.append(ex[0]["file"])
|
| 268 |
+
prev_ex_is_image = True
|
| 269 |
else:
|
| 270 |
+
if prev_ex_is_image:
|
| 271 |
+
conversations.append([f"User:<image>{ex[0]}", f"\nAssistant:{ex[1]}"])
|
| 272 |
+
else:
|
| 273 |
+
conversations.append([f"User:{ex[0]}", f"\nAssistant:{ex[1]}"])
|
| 274 |
+
prev_ex_is_image = False
|
| 275 |
+
|
| 276 |
+
print(f"conversations: {conversations}\n dtype:{type(conversations)}")
|
| 277 |
+
print(f"chat_history: {chat_history}\n dtype: {type(chat_history)}")
|
| 278 |
dope_dataset_writer.flag(
|
| 279 |
flag_data=[
|
| 280 |
model_selector,
|
|
|
|
| 362 |
# The second syntax allows inputting an arbitrary number of images.""")
|
| 363 |
|
| 364 |
image_fake = gr.Image(visible=False)
|
|
|
|
| 365 |
|
| 366 |
with gr.Blocks(
|
| 367 |
fill_height=True,
|
|
|
|
| 441 |
[
|
| 442 |
model_selector,
|
| 443 |
image_fake,
|
| 444 |
+
chatbot,
|
| 445 |
decoding_strategy,
|
| 446 |
temperature,
|
| 447 |
max_new_tokens,
|
|
|
|
| 469 |
[
|
| 470 |
model_selector,
|
| 471 |
image_fake,
|
| 472 |
+
chatbot,
|
| 473 |
decoding_strategy,
|
| 474 |
temperature,
|
| 475 |
max_new_tokens,
|