Spaces:
Runtime error
Runtime error
Update app_dialogue.py
Browse files- app_dialogue.py +11 -11
app_dialogue.py
CHANGED
@@ -257,7 +257,7 @@ def flag_chat(
|
|
257 |
top_p,
|
258 |
):
|
259 |
images = []
|
260 |
-
|
261 |
prev_ex_is_image = False
|
262 |
for ex in chat_history:
|
263 |
if isinstance(ex[0], dict):
|
@@ -265,16 +265,16 @@ def flag_chat(
|
|
265 |
prev_ex_is_image = True
|
266 |
else:
|
267 |
if prev_ex_is_image:
|
268 |
-
|
269 |
else:
|
270 |
-
|
271 |
prev_ex_is_image = False
|
272 |
-
|
273 |
dope_dataset_writer.flag(
|
274 |
flag_data=[
|
275 |
model_selector,
|
276 |
images[0],
|
277 |
-
|
278 |
decoding_strategy,
|
279 |
temperature,
|
280 |
max_new_tokens,
|
@@ -356,8 +356,8 @@ problematic_dataset_writer = gr.HuggingFaceDatasetSaver(
|
|
356 |
|
357 |
# The second syntax allows inputting an arbitrary number of images.""")
|
358 |
|
359 |
-
|
360 |
-
|
361 |
with gr.Blocks(
|
362 |
fill_height=True,
|
363 |
css=""".gradio-container .avatar-container {height: 40px width: 40px !important;}""",
|
@@ -435,8 +435,8 @@ with gr.Blocks(
|
|
435 |
dope_dataset_writer.setup(
|
436 |
[
|
437 |
model_selector,
|
438 |
-
|
439 |
-
|
440 |
decoding_strategy,
|
441 |
temperature,
|
442 |
max_new_tokens,
|
@@ -463,8 +463,8 @@ with gr.Blocks(
|
|
463 |
problematic_dataset_writer.setup(
|
464 |
[
|
465 |
model_selector,
|
466 |
-
|
467 |
-
|
468 |
decoding_strategy,
|
469 |
temperature,
|
470 |
max_new_tokens,
|
|
|
257 |
top_p,
|
258 |
):
|
259 |
images = []
|
260 |
+
text_flag = []
|
261 |
prev_ex_is_image = False
|
262 |
for ex in chat_history:
|
263 |
if isinstance(ex[0], dict):
|
|
|
265 |
prev_ex_is_image = True
|
266 |
else:
|
267 |
if prev_ex_is_image:
|
268 |
+
text_flag.append([f"User:<image>{ex[0]}", f"Assistant:{ex[1]}"])
|
269 |
else:
|
270 |
+
text_flag.append([f"User:{ex[0]}", f"Assistant:{ex[1]}"])
|
271 |
prev_ex_is_image = False
|
272 |
+
image_flag = images[0]
|
273 |
dope_dataset_writer.flag(
|
274 |
flag_data=[
|
275 |
model_selector,
|
276 |
images[0],
|
277 |
+
text_flag,
|
278 |
decoding_strategy,
|
279 |
temperature,
|
280 |
max_new_tokens,
|
|
|
356 |
|
357 |
# The second syntax allows inputting an arbitrary number of images.""")
|
358 |
|
359 |
+
image_flag = gr.Image(visible=False)
|
360 |
+
text_flag = gr.Textbox(visible=False)
|
361 |
with gr.Blocks(
|
362 |
fill_height=True,
|
363 |
css=""".gradio-container .avatar-container {height: 40px width: 40px !important;}""",
|
|
|
435 |
dope_dataset_writer.setup(
|
436 |
[
|
437 |
model_selector,
|
438 |
+
image_flag,
|
439 |
+
text_flag,
|
440 |
decoding_strategy,
|
441 |
temperature,
|
442 |
max_new_tokens,
|
|
|
463 |
problematic_dataset_writer.setup(
|
464 |
[
|
465 |
model_selector,
|
466 |
+
image_flag,
|
467 |
+
text_flag,
|
468 |
decoding_strategy,
|
469 |
temperature,
|
470 |
max_new_tokens,
|