ryanzhangfan commited on
Commit
a7c6ff5
β€’
1 Parent(s): 7e88e86

add router hint and highlight fast demo

Browse files
app.py CHANGED
@@ -6,7 +6,7 @@
6
  # Email : zhangfan@baai.ac.cn
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-11 15:34
9
- # Last Modified : 2023-12-29 08:04
10
  # File Name : app.py
11
  # Description :
12
  #
@@ -36,14 +36,19 @@ parser.add_argument("--disable-generate", action="store_true")
36
  args = parser.parse_args()
37
 
38
 
 
39
  if __name__ == "__main__":
40
  title = "Emu2: Generative Multimodal Models are In-Context Learners<br> \
41
  <h2 align='center'> \
42
  [<a href='https://baaivision.github.io/emu2' target='_blank' rel='noopener'>project page</a>] \
43
  [<a href='https://github.com/baaivision/Emu' target='_blank' rel='noopener'>code</a>] \
44
  [<a href='https://arxiv.org/abs/2312.13286' target='_blank' rel='noopener'>paper</a>] \
45
- [<a href='https://emu.ssi.plus' target='_blank' rel='noopener'>FAST demo</a>] \
46
  </h2> \
 
 
 
 
 
47
  <h3 align='center'> \
48
  πŸ€—HF models: \
49
  <a href='https://huggingface.co/BAAI/Emu2' target='_blank' rel='noopener'>Emu2</a> | \
 
6
  # Email : zhangfan@baai.ac.cn
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-11 15:34
9
+ # Last Modified : 2024-01-04 10:15
10
  # File Name : app.py
11
  # Description :
12
  #
 
36
  args = parser.parse_args()
37
 
38
 
39
+ # <h2 align='center'>[<a href='https://emu.ssi.plus' target='_blank' rel='noopener'>FAST demo</a>]</h2>
40
  if __name__ == "__main__":
41
  title = "Emu2: Generative Multimodal Models are In-Context Learners<br> \
42
  <h2 align='center'> \
43
  [<a href='https://baaivision.github.io/emu2' target='_blank' rel='noopener'>project page</a>] \
44
  [<a href='https://github.com/baaivision/Emu' target='_blank' rel='noopener'>code</a>] \
45
  [<a href='https://arxiv.org/abs/2312.13286' target='_blank' rel='noopener'>paper</a>] \
 
46
  </h2> \
47
+ <div align='center'> \
48
+ <font size=4>Experience Emu2 with πŸ‘‰</font> \
49
+ <font size=6>[<b><a href='https://emu.ssi.plus' target='_blank' rel='noopener'>FAST demo</a>]</b></font> \
50
+ <font size=4>πŸ‘ˆ <b>WAY MORE FASTER!!!</b></font> \
51
+ </div> \
52
  <h3 align='center'> \
53
  πŸ€—HF models: \
54
  <a href='https://huggingface.co/BAAI/Emu2' target='_blank' rel='noopener'>Emu2</a> | \
demo/chat_frontend.py CHANGED
@@ -6,7 +6,7 @@
6
  # Email : zhangfan@baai.ac.cn
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-12 18:05
9
- # Last Modified : 2023-12-22 10:29
10
  # File Name : chat_frontend.py
11
  # Description :
12
  #
@@ -23,7 +23,7 @@ import gradio as gr
23
  from .meta import ConvMeta, Role, DataMeta
24
  from .utils import extract_frames
25
  from .utils import frontend_logger as logging
26
- from .constants import TERM_OF_USE, CHAT_GUIDANCE, RECOMMEND
27
 
28
  CONTROLLER_URL = ""
29
 
@@ -164,6 +164,7 @@ def build_chat(args):
164
  with gr.Blocks(title="Emu", theme=gr.themes.Default(primary_hue="blue", secondary_hue="blue")) as demo:
165
  state = gr.State()
166
 
 
167
  gr.Markdown(CHAT_GUIDANCE)
168
  gr.Markdown(RECOMMEND)
169
 
 
6
  # Email : zhangfan@baai.ac.cn
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-12 18:05
9
+ # Last Modified : 2024-01-04 09:42
10
  # File Name : chat_frontend.py
11
  # Description :
12
  #
 
23
  from .meta import ConvMeta, Role, DataMeta
24
  from .utils import extract_frames
25
  from .utils import frontend_logger as logging
26
+ from .constants import CHAT_ROUTER, TERM_OF_USE, CHAT_GUIDANCE, RECOMMEND
27
 
28
  CONTROLLER_URL = ""
29
 
 
164
  with gr.Blocks(title="Emu", theme=gr.themes.Default(primary_hue="blue", secondary_hue="blue")) as demo:
165
  state = gr.State()
166
 
167
+ gr.Markdown(CHAT_ROUTER)
168
  gr.Markdown(CHAT_GUIDANCE)
169
  gr.Markdown(RECOMMEND)
170
 
demo/constants.py CHANGED
@@ -54,3 +54,6 @@ LICENSE = "### License\nπŸ“ŒThe service is a research preview intended for non-c
54
  CHAT_GUIDANCE = "<font size=4>πŸ’‘<b><u>NOTE</u></b>πŸ’‘: You can <b><u>_ONLY_</u></b> input one modality at a time. Please <b><u>_CLICK_</u></b> Add button after entering one modality input. And then input the <b><u>_NEXT_</u></b> modality.</font>"
55
  GEN_GUIDANCE = "<font size=4>πŸ’‘<b><u>NOTE</u></b>πŸ’‘: You can <b><u>_ONLY_</u></b> input one modality at a time (except for <b><u>_location-binded_</u></b> inputs). Please <b><u>_CLICK_</u></b> Add button after entering one modality input. And then input the <b><u>_NEXT_</u></b> modality.</font>"
56
  RECOMMEND = "<font size=2>Strongly <b><u>_RECOMMAND_</u></b> reading the [user guide](https://jwolpxeehx.feishu.cn/docx/RYHNd1tvEo8k8Mx9HeMcvvxWnvZ) before trying out this demo.</font>"
 
 
 
 
54
  CHAT_GUIDANCE = "<font size=4>πŸ’‘<b><u>NOTE</u></b>πŸ’‘: You can <b><u>_ONLY_</u></b> input one modality at a time. Please <b><u>_CLICK_</u></b> Add button after entering one modality input. And then input the <b><u>_NEXT_</u></b> modality.</font>"
55
  GEN_GUIDANCE = "<font size=4>πŸ’‘<b><u>NOTE</u></b>πŸ’‘: You can <b><u>_ONLY_</u></b> input one modality at a time (except for <b><u>_location-binded_</u></b> inputs). Please <b><u>_CLICK_</u></b> Add button after entering one modality input. And then input the <b><u>_NEXT_</u></b> modality.</font>"
56
  RECOMMEND = "<font size=2>Strongly <b><u>_RECOMMAND_</u></b> reading the [user guide](https://jwolpxeehx.feishu.cn/docx/RYHNd1tvEo8k8Mx9HeMcvvxWnvZ) before trying out this demo.</font>"
57
+
58
+ CHAT_ROUTER = "<font size=4>🚏<b><u>ROUTER</u></b>🚏:This tab can <b><u>_ONLY_</u></b> generate <b><u>_TEXT_</u></b> output. If you want to generate images, please use <b>_Multimodal Generation_</b>.</font>"
59
+ GEN_ROUTER = "<font size=4>🚏<b><u>ROUTER</u></b>🚏:This tab can <b><u>_ONLY_</u></b> generate <b><u>_IMAGE_</u></b> output. If you want to generate texts, please use <b>_Multimodal Chat_</b>.</font>"
demo/generation_frontend.py CHANGED
@@ -6,7 +6,7 @@
6
  # Email : zhangfan@baai.ac.cn
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-11 15:35
9
- # Last Modified : 2023-12-22 10:29
10
  # File Name : generation_frontend.py
11
  # Description :
12
  #
@@ -21,7 +21,7 @@ import requests
21
 
22
  import gradio as gr
23
 
24
- from .constants import EVA_IMAGE_SIZE
25
  from .meta import ConvMeta, Role, DataMeta
26
  from .utils import frontend_logger as logging
27
  from .constants import TERM_OF_USE, GEN_GUIDANCE, RECOMMEND
@@ -161,6 +161,7 @@ def build_generation(args):
161
  state = gr.State()
162
 
163
  gr.Markdown("<font size=5><center><b>This demo</b> can accept a mix of <b><u>_texts_</u></b>, <b><u>_locations_</u></b> and <b><u>_images_</u></b> as input, and generating images in context</center></font>")
 
164
  gr.Markdown(GEN_GUIDANCE)
165
  gr.Markdown(RECOMMEND)
166
  gr.Markdown("<font size=4>πŸ’‘<b><u>Tips</b></u>πŸ’‘:</font> To achieve better generation quality\n \
 
6
  # Email : zhangfan@baai.ac.cn
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-11 15:35
9
+ # Last Modified : 2024-01-04 09:43
10
  # File Name : generation_frontend.py
11
  # Description :
12
  #
 
21
 
22
  import gradio as gr
23
 
24
+ from .constants import EVA_IMAGE_SIZE, GEN_ROUTER
25
  from .meta import ConvMeta, Role, DataMeta
26
  from .utils import frontend_logger as logging
27
  from .constants import TERM_OF_USE, GEN_GUIDANCE, RECOMMEND
 
161
  state = gr.State()
162
 
163
  gr.Markdown("<font size=5><center><b>This demo</b> can accept a mix of <b><u>_texts_</u></b>, <b><u>_locations_</u></b> and <b><u>_images_</u></b> as input, and generating images in context</center></font>")
164
+ gr.Markdown(GEN_ROUTER)
165
  gr.Markdown(GEN_GUIDANCE)
166
  gr.Markdown(RECOMMEND)
167
  gr.Markdown("<font size=4>πŸ’‘<b><u>Tips</b></u>πŸ’‘:</font> To achieve better generation quality\n \