ysharma HF staff commited on
Commit
dd96978
1 Parent(s): 14be3d0

added examples

Browse files
Files changed (1) hide show
  1. app_dialogue.py +15 -0
app_dialogue.py CHANGED
@@ -697,6 +697,10 @@ with gr.Blocks(title="IDEFICS", theme=gr.themes.Base()) as demo:
697
  )
698
  return "", None, chat_history
699
 
 
 
 
 
700
  textbox.submit(
701
  fn=model_inference,
702
  inputs=[
@@ -742,5 +746,16 @@ with gr.Blocks(title="IDEFICS", theme=gr.themes.Base()) as demo:
742
  ],
743
  )
744
 
 
 
 
 
 
 
 
 
 
 
 
745
  demo.queue()
746
  demo.launch()
 
697
  )
698
  return "", None, chat_history
699
 
700
+ def process_example(message):
701
+ clear_msg, image_value, chat = model_inference(message, [], None, "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(
705
  fn=model_inference,
706
  inputs=[
 
746
  ],
747
  )
748
 
749
+ gr.Examples(examples=[
750
+ #[f"{cur_dir}/examples/extreme_ironing.jpg", "What is unusual about this image?"],
751
+ #[f"{cur_dir}/examples/waterview.jpg", "What are the things I should be cautious about when I visit here?"],
752
+ ["<fake_token_around_image><https://huggingface.co/spaces/ysharma/m4-dialogue/resolve/main/images/bear.jpg><fake_token_around_image> Describe this image"],
753
+ ],
754
+ inputs=[textbox],
755
+ outputs=[textbox, imagebox, chatbot],
756
+ fn=process_example,
757
+ cache_examples=True,
758
+ )
759
+
760
  demo.queue()
761
  demo.launch()