Spaces:
Runtime error
Runtime error
added example with images
Browse files- app_dialogue.py +14 -6
app_dialogue.py
CHANGED
|
@@ -697,8 +697,8 @@ with gr.Blocks(title="IDEFICS", theme=gr.themes.Base()) as demo:
|
|
| 697 |
)
|
| 698 |
return "", None, chat_history
|
| 699 |
|
| 700 |
-
def process_example(message):
|
| 701 |
-
clear_msg, image_value, chat = model_inference(message, [],
|
| 702 |
return clear_msg, image_value, chat
|
| 703 |
|
| 704 |
textbox.submit(
|
|
@@ -747,11 +747,19 @@ with gr.Blocks(title="IDEFICS", theme=gr.themes.Base()) as demo:
|
|
| 747 |
)
|
| 748 |
|
| 749 |
gr.Examples(examples=[
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
["
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 753 |
],
|
| 754 |
-
inputs=[textbox],
|
| 755 |
outputs=[textbox, imagebox, chatbot],
|
| 756 |
fn=process_example,
|
| 757 |
cache_examples=True,
|
|
|
|
| 697 |
)
|
| 698 |
return "", None, chat_history
|
| 699 |
|
| 700 |
+
def process_example(message, image):
|
| 701 |
+
clear_msg, image_value, chat = model_inference(message, [], image, "greedy", 3, 1.0, 0, 512, 16, 1.0, 1.0, 50, 0.95, 0.95)
|
| 702 |
return clear_msg, image_value, chat
|
| 703 |
|
| 704 |
textbox.submit(
|
|
|
|
| 747 |
)
|
| 748 |
|
| 749 |
gr.Examples(examples=[
|
| 750 |
+
["example_images/baguettes_guarding_paris.png","What are the armed baguettes guarding?"],
|
| 751 |
+
["example_images/bear_costume.png","Can you describe the image?"],
|
| 752 |
+
["example_images/can_horror.png","What is this object and do you think it is horrifying?"],
|
| 753 |
+
["example_images/chicken_on_money.png","Can you tell me a very short story based on this image?"],
|
| 754 |
+
["example_images/dragons_playing.png","Describe the image in vivid details?"],
|
| 755 |
+
["example_images/ironman_cap.png","Can you tell me about this image and why is it so cool?"],
|
| 756 |
+
["example_images/polar_bear_coke.png","Can you write an advertisement jingle based on this image for Coca-Cola?"],
|
| 757 |
+
["example_images/rabbit_force.png","What is so macho and qute about this image?"],
|
| 758 |
+
["example_images/ramen.png","What is happening in this image and is it unusual?"],
|
| 759 |
+
["example_images/tree_fortress.jpg","What I should look most forward to when I visit here?"],
|
| 760 |
+
["<fake_token_around_image><image:https://huggingface.co/spaces/ysharma/m4-dialogue/resolve/main/images/bear.jpg><fake_token_around_image> Describe this image", None],
|
| 761 |
],
|
| 762 |
+
inputs=[textbox, imagebox],
|
| 763 |
outputs=[textbox, imagebox, chatbot],
|
| 764 |
fn=process_example,
|
| 765 |
cache_examples=True,
|