Leyo HF staff commited on
Commit
e3b3385
1 Parent(s): bc38a65

update layout

Browse files
Files changed (1) hide show
  1. app_dialogue.py +45 -47
app_dialogue.py CHANGED
@@ -62,7 +62,7 @@ BAN_TOKENS = ( # For documentation puporse. We are not using this list, it is h
62
  EOS_STRINGS = ["<end_of_utterance>", "\nUser:"]
63
  STOP_SUSPECT_LIST = []
64
 
65
- GRADIO_LINK = "https://huggingfacem4-ai-meme-generator.hf.space"
66
  API_TOKEN = os.getenv("HF_AUTH_TOKEN")
67
  IDEFICS_LOGO = "https://huggingface.co/spaces/HuggingFaceM4/idefics_playground/resolve/main/IDEFICS_logo.png"
68
 
@@ -152,7 +152,7 @@ for image_dir in os.listdir("example_images"):
152
  tmp_filename = H.preprocess(H.value)
153
  DEFAULT_IMAGES_TMP_PATH_TO_URL[
154
  tmp_filename
155
- ] = f"https://huggingface.co/spaces/HuggingFaceM4/AI_Meme_Generator/resolve/main/example_images/{image_dir}/{im_path}"
156
 
157
 
158
  # Utils to handle the image markdown display logic
@@ -586,26 +586,6 @@ chatbot = gr.Chatbot(
586
 
587
  with gr.Blocks(title="AI Meme Generator", theme=gr.themes.Base()) as demo:
588
  gr.HTML("""<h1 align="center">AI Meme Generator</h1>""")
589
- with gr.Row(variant="panel"):
590
- with gr.Column(scale=1):
591
- gr.Image(
592
- IDEFICS_LOGO,
593
- elem_id="banner-image",
594
- show_label=False,
595
- show_download_button=False,
596
- height=200,
597
- width=250,
598
- )
599
- with gr.Column(scale=5):
600
- gr.HTML(
601
- """
602
- <p><strong>AI Meme Generator</strong> is an AI system that writes humorous content inspired by images, allowing you to make the funniest memes with little effort. Upload your image and ask the Idefics chatbot to make a tailored meme.</p>
603
- <p>AI Meme Generator is a space inspired from <a href="https://huggingface.co/spaces/HuggingFaceM4/ai_dad_jokes">AI Dad Jokes</a> and powered by <a href="https://huggingface.co/blog/idefics">IDEFICS</a>, an open-access large visual language model developped by Hugging Face. Like GPT-4, the multimodal model accepts arbitrary sequences of image and text inputs and produces text outputs. IDEFICS can answer questions about images, describe visual content, create stories grounded in multiple images, etc.</p>
604
-
605
- <p>⛔️ <strong>Intended uses and limitations:</strong> This demo is provided as research artifact to the community showcasing IDEFICS'capabilities. We detail misuses and out-of-scope uses <a href="https://huggingface.co/HuggingFaceM4/idefics-80b#misuse-and-out-of-scope-use">here</a>. In particular, the system should not be used to engage in harassment, abuse and bullying. The model can produce factually incorrect texts, hallucinate facts (with or without an image) and will struggle with small details in images. While the system will tend to refuse answering questionable user requests, it can produce problematic outputs (including racist, stereotypical, and disrespectful texts), in particular when prompted to do so.</p>
606
- """
607
- )
608
-
609
  with gr.Row(elem_id="model_selector_row"):
610
  model_selector = gr.Dropdown(
611
  choices=MODELS,
@@ -616,31 +596,6 @@ with gr.Blocks(title="AI Meme Generator", theme=gr.themes.Base()) as demo:
616
  label="Model",
617
  visible=False,
618
  )
619
-
620
- with gr.Row(equal_height=True):
621
- with gr.Box(elem_id="gallery_box"):
622
- gallery_type_choice = gr.Radio(
623
- [
624
- "All",
625
- "Meme templates",
626
- "Funny images",
627
- "Politics",
628
- ],
629
- value="All",
630
- label="Gallery Type",
631
- interactive=True,
632
- visible=False,
633
- info="Choose the type of gallery you want to see.",
634
- )
635
- template_gallery = gr.Gallery(
636
- # value= value given by gallery_type_choice,
637
- label="Templates Gallery",
638
- allow_preview=False,
639
- columns=[6],
640
- elem_id="gallery",
641
- show_share_button=False,
642
- height=400,
643
- )
644
  with gr.Row(equal_height=True):
645
  with gr.Column(equal_height=1):
646
  imagebox = gr.Image(
@@ -771,6 +726,49 @@ with gr.Blocks(title="AI Meme Generator", theme=gr.themes.Base()) as demo:
771
  show_download_button=True,
772
  show_share_button=True,
773
  ).style(columns=[2], object_fit="contain", height=600)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  with gr.Row():
775
  chatbot.render()
776
 
 
62
  EOS_STRINGS = ["<end_of_utterance>", "\nUser:"]
63
  STOP_SUSPECT_LIST = []
64
 
65
+ GRADIO_LINK = "https://leyo-ai-meme-generator.hf.space"
66
  API_TOKEN = os.getenv("HF_AUTH_TOKEN")
67
  IDEFICS_LOGO = "https://huggingface.co/spaces/HuggingFaceM4/idefics_playground/resolve/main/IDEFICS_logo.png"
68
 
 
152
  tmp_filename = H.preprocess(H.value)
153
  DEFAULT_IMAGES_TMP_PATH_TO_URL[
154
  tmp_filename
155
+ ] = f"https://huggingface.co/spaces/Leyo/AI_Meme_Generator/resolve/main/example_images/{image_dir}/{im_path}"
156
 
157
 
158
  # Utils to handle the image markdown display logic
 
586
 
587
  with gr.Blocks(title="AI Meme Generator", theme=gr.themes.Base()) as demo:
588
  gr.HTML("""<h1 align="center">AI Meme Generator</h1>""")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
589
  with gr.Row(elem_id="model_selector_row"):
590
  model_selector = gr.Dropdown(
591
  choices=MODELS,
 
596
  label="Model",
597
  visible=False,
598
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
  with gr.Row(equal_height=True):
600
  with gr.Column(equal_height=1):
601
  imagebox = gr.Image(
 
726
  show_download_button=True,
727
  show_share_button=True,
728
  ).style(columns=[2], object_fit="contain", height=600)
729
+ with gr.Row(equal_height=True):
730
+ with gr.Box(elem_id="gallery_box"):
731
+ gallery_type_choice = gr.Radio(
732
+ [
733
+ "All",
734
+ "Meme templates",
735
+ "Funny images",
736
+ "Politics",
737
+ ],
738
+ value="All",
739
+ label="Gallery Type",
740
+ interactive=True,
741
+ visible=False,
742
+ info="Choose the type of gallery you want to see.",
743
+ )
744
+ template_gallery = gr.Gallery(
745
+ # value= value given by gallery_type_choice,
746
+ label="Templates Gallery",
747
+ allow_preview=False,
748
+ columns=[6],
749
+ elem_id="gallery",
750
+ show_share_button=False,
751
+ height=400,
752
+ )
753
+ with gr.Row(variant="panel"):
754
+ with gr.Column(scale=1):
755
+ gr.Image(
756
+ IDEFICS_LOGO,
757
+ elem_id="banner-image",
758
+ show_label=False,
759
+ show_download_button=False,
760
+ height=200,
761
+ width=250,
762
+ )
763
+ with gr.Column(scale=5):
764
+ gr.HTML(
765
+ """
766
+ <p><strong>AI Meme Generator</strong> is an AI system that writes humorous content inspired by images, allowing you to make the funniest memes with little effort. Upload your image and ask the Idefics chatbot to make a tailored meme.</p>
767
+ <p>AI Meme Generator is a space inspired from <a href="https://huggingface.co/spaces/HuggingFaceM4/ai_dad_jokes">AI Dad Jokes</a> and powered by <a href="https://huggingface.co/blog/idefics">IDEFICS</a>, an open-access large visual language model developped by Hugging Face. Like GPT-4, the multimodal model accepts arbitrary sequences of image and text inputs and produces text outputs. IDEFICS can answer questions about images, describe visual content, create stories grounded in multiple images, etc.</p>
768
+
769
+ <p>⛔️ <strong>Intended uses and limitations:</strong> This demo is provided as research artifact to the community showcasing IDEFICS'capabilities. We detail misuses and out-of-scope uses <a href="https://huggingface.co/HuggingFaceM4/idefics-80b#misuse-and-out-of-scope-use">here</a>. In particular, the system should not be used to engage in harassment, abuse and bullying. The model can produce factually incorrect texts, hallucinate facts (with or without an image) and will struggle with small details in images. While the system will tend to refuse answering questionable user requests, it can produce problematic outputs (including racist, stereotypical, and disrespectful texts), in particular when prompted to do so.</p>
770
+ """
771
+ )
772
  with gr.Row():
773
  chatbot.render()
774