Spaces:
Build error
Build error
Update app_dialogue.py
Browse files- app_dialogue.py +65 -65
app_dialogue.py
CHANGED
@@ -554,25 +554,25 @@ def model_generation(
|
|
554 |
|
555 |
return generated_text
|
556 |
|
557 |
-
def process_example(message, image):
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
|
577 |
dope_callback = gr.CSVLogger()
|
578 |
dope_hf_callback = gr.HuggingFaceDatasetSaver(
|
@@ -1045,52 +1045,52 @@ And so, the story of Mulan and Shrek's romance came to an end, leaving a lasting
|
|
1045 |
examples=[
|
1046 |
["What are the armed baguettes guarding?", f"{examples_path}/example_images/baguettes_guarding_paris.png"],
|
1047 |
[
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
],
|
1095 |
inputs=[textbox, imagebox],
|
1096 |
outputs=[textbox, imagebox, chatbot],
|
|
|
554 |
|
555 |
return generated_text
|
556 |
|
557 |
+
def process_example(message, image):
|
558 |
+
print("********* process_example **********")
|
559 |
+
clear_msg, image_value, chat = model_inference(
|
560 |
+
user_prompt_str=message,
|
561 |
+
chat_history=[],
|
562 |
+
image=image,
|
563 |
+
decoding_strategy="Greedy",
|
564 |
+
num_beams=None,
|
565 |
+
temperature=None,
|
566 |
+
no_repeat_ngram_size=None,
|
567 |
+
max_new_tokens=512,
|
568 |
+
min_length=16,
|
569 |
+
repetition_penalty=None,
|
570 |
+
length_penalty=None,
|
571 |
+
top_k=None,
|
572 |
+
top_p=0.95,
|
573 |
+
penalty_alpha=None,
|
574 |
+
)
|
575 |
+
return clear_msg, image_value, chat
|
576 |
|
577 |
dope_callback = gr.CSVLogger()
|
578 |
dope_hf_callback = gr.HuggingFaceDatasetSaver(
|
|
|
1045 |
examples=[
|
1046 |
["What are the armed baguettes guarding?", f"{examples_path}/example_images/baguettes_guarding_paris.png"],
|
1047 |
[
|
1048 |
+
"Can you tell me a very short story based on this image?",
|
1049 |
+
f"{examples_path}/example_images/chicken_on_money.png",
|
1050 |
+
],
|
1051 |
+
["Can you describe the image?", f"{examples_path}/example_images/bear_costume.png"],
|
1052 |
+
["What is this animal and why is it unusual?", f"{examples_path}/example_images/blue_dog.png"],
|
1053 |
+
[
|
1054 |
+
"What is this object and do you think it is horrifying?",
|
1055 |
+
f"{examples_path}/example_images/can_horror.png",
|
1056 |
+
],
|
1057 |
+
["What is this sketch for? How would you make an argument to prove this sketch was made by Picasso himself?", f"{examples_path}/example_images/cat_sketch.png"],
|
1058 |
+
["Which celebrity does this claymation figure look like?", f"{examples_path}/example_images/kanye.jpg"],
|
1059 |
+
[
|
1060 |
+
"Which famous person does the person in the image look like? Could you craft an engaging narrative featuring this character from the image as the main protagonist?",
|
1061 |
+
f"{examples_path}/example_images/obama-harry-potter.jpg",
|
1062 |
+
],
|
1063 |
+
[
|
1064 |
+
"Is there a celebrity look-alike in this image? What is happening to the person?",
|
1065 |
+
f"{examples_path}/example_images/ryan-reynolds-borg.jpg",
|
1066 |
+
],
|
1067 |
+
["Can you describe this image in details please?", f"{examples_path}/example_images/dragons_playing.png"],
|
1068 |
+
["What can you tell me about the cap in this image?", f"{examples_path}/example_images/ironman_cap.png"],
|
1069 |
+
[
|
1070 |
+
"Can you write an advertisement for Coca-Cola based on this image?",
|
1071 |
+
f"{examples_path}/example_images/polar_bear_coke.png",
|
1072 |
+
],
|
1073 |
+
[
|
1074 |
+
"What is the rabbit doing in this image? Do you think this image is real?",
|
1075 |
+
f"{examples_path}/example_images/rabbit_force.png",
|
1076 |
+
],
|
1077 |
+
["What is happening in this image and why is it unusual?", f"{examples_path}/example_images/ramen.png"],
|
1078 |
+
[
|
1079 |
+
"What I should look most forward to when I visit this place?",
|
1080 |
+
f"{examples_path}/example_images/tree_fortress.jpg",
|
1081 |
+
],
|
1082 |
+
["Who is the person in the image and what is he doing?", f"{examples_path}/example_images/tom-cruise-astronaut-pegasus.jpg"],
|
1083 |
+
[
|
1084 |
+
"What is happening in this image? Which famous personality does this person in center looks like?",
|
1085 |
+
f"{examples_path}/example_images/gandhi_selfie.jpg",
|
1086 |
+
],
|
1087 |
+
[
|
1088 |
+
(
|
1089 |
+
"<fake_token_around_image><image:https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/stable-diffusion-xl-coreml/a_high_quality_photo_of_a_surfing_dog.7667.final_float16_original.jpg><fake_token_around_image>What"
|
1090 |
+
" do you think the dog is doing and is it unusual?"
|
1091 |
+
),
|
1092 |
+
None,
|
1093 |
+
],
|
1094 |
],
|
1095 |
inputs=[textbox, imagebox],
|
1096 |
outputs=[textbox, imagebox, chatbot],
|