Leyo multimodalart HF staff commited on
Commit
0c76176
1 Parent(s): 86703cf

Auto-generate when uploaded (#2)

Browse files

- Auto-generate when uploaded (22bde40ecad1560fa78ab40b3f253a1389a3e59d)


Co-authored-by: Apolinário from multimodal AI art <[email protected]>

Files changed (1) hide show
  1. app_dialogue.py +25 -1
app_dialogue.py CHANGED
@@ -921,7 +921,31 @@ with gr.Blocks(title="AI Meme Generator", theme=gr.themes.Base()) as demo:
921
  ],
922
  outputs=[textbox, generated_memes_gallery, chatbot],
923
  )
924
- submit_btn.click(fn=lambda: "", inputs=[], outputs=[generated_memes_gallery]).then(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
925
  fn=model_inference,
926
  inputs=[
927
  model_selector,
 
921
  ],
922
  outputs=[textbox, generated_memes_gallery, chatbot],
923
  )
924
+ imagebox.upload(fn=lambda: "", inputs=[], outputs=[generated_memes_gallery], queue=False).then(
925
+ fn=lambda: "Write a meme about this image.", inputs=[], outputs=[textbox], queue=False).then(
926
+ fn=model_inference,
927
+ inputs=[
928
+ model_selector,
929
+ system_prompt,
930
+ textbox,
931
+ chatbot,
932
+ imagebox,
933
+ decoding_strategy,
934
+ temperature,
935
+ max_new_tokens,
936
+ repetition_penalty,
937
+ top_p,
938
+ all_caps_meme_text,
939
+ text_at_the_top,
940
+ font_meme_text,
941
+ ],
942
+ outputs=[
943
+ textbox,
944
+ generated_memes_gallery,
945
+ chatbot,
946
+ ],
947
+ )
948
+ submit_btn.click(fn=lambda: "", inputs=[], outputs=[generated_memes_gallery], queue=False).then(
949
  fn=model_inference,
950
  inputs=[
951
  model_selector,