ryanzhangfan commited on
Commit
6e90f61
1 Parent(s): 624a982

add more hints

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-21 02:25
10
  # File Name : app.py
11
  # Description :
12
  #
@@ -57,16 +57,16 @@ if __name__ == "__main__":
57
 
58
 
59
  interface_list, tab_names = [], []
60
- if not args.disable_generate:
61
- demo_generation = build_generation(args)
62
- interface_list.append(demo_generation)
63
- tab_names.append("Multimodal Generation")
64
-
65
  if not args.disable_chat:
66
  demo_chat = build_chat(args)
67
  interface_list.append(demo_chat)
68
  tab_names.append("Multimodal Chat")
69
 
 
 
 
 
 
70
  demo_all = gr.TabbedInterface(
71
  interface_list=interface_list,
72
  tab_names=tab_names,
 
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-21 06:45
10
  # File Name : app.py
11
  # Description :
12
  #
 
57
 
58
 
59
  interface_list, tab_names = [], []
 
 
 
 
 
60
  if not args.disable_chat:
61
  demo_chat = build_chat(args)
62
  interface_list.append(demo_chat)
63
  tab_names.append("Multimodal Chat")
64
 
65
+ if not args.disable_generate:
66
+ demo_generation = build_generation(args)
67
+ interface_list.append(demo_generation)
68
+ tab_names.append("Multimodal Generation")
69
+
70
  demo_all = gr.TabbedInterface(
71
  interface_list=interface_list,
72
  tab_names=tab_names,
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-21 04:08
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
27
 
28
  CONTROLLER_URL = ""
29
 
@@ -164,6 +164,8 @@ 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
 
168
  with gr.Row():
169
  with gr.Column(scale=2):
 
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-21 06:13
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 TERM_OF_USE, 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(GUIDANCE)
168
+ gr.Markdown(RECOMMEND)
169
 
170
  with gr.Row():
171
  with gr.Column(scale=2):
demo/constants.py CHANGED
@@ -50,3 +50,6 @@ FAKE_VIDEO_END_TOKEN = "[/VIDEO]"
50
  TERM_OF_USE = "### Terms of use\n📌By using this service, users are required to agree to the following terms: The service is a research preview intended for non-commercial use only. It only provides limited safety measures and may generate offensive content. It must not be used for any illegal, harmful, violent, racist, or sexual purposes. The service may collect user dialogue data for future research."
51
 
52
  LICENSE = "### License\n📌The service is a research preview intended for non-commercial use only, subject to the model [License](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md) of LLaMA, [Terms of Use](https://openai.com/policies/terms-of-use) of content by OpenAI, and [Privacy Practices](https://chromewebstore.google.com/detail/sharegpt-share-your-chatg/daiacboceoaocpibfodeljbdfacokfjb) of ShareGPT. Please contact us if you find any potential violation."
 
 
 
 
50
  TERM_OF_USE = "### Terms of use\n📌By using this service, users are required to agree to the following terms: The service is a research preview intended for non-commercial use only. It only provides limited safety measures and may generate offensive content. It must not be used for any illegal, harmful, violent, racist, or sexual purposes. The service may collect user dialogue data for future research."
51
 
52
  LICENSE = "### License\n📌The service is a research preview intended for non-commercial use only, subject to the model [License](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md) of LLaMA, [Terms of Use](https://openai.com/policies/terms-of-use) of content by OpenAI, and [Privacy Practices](https://chromewebstore.google.com/detail/sharegpt-share-your-chatg/daiacboceoaocpibfodeljbdfacokfjb) of ShareGPT. Please contact us if you find any potential violation."
53
+
54
+ 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
+ RECOMMEND = "<font size=2>Strongly <b><u>_RECOMMAND_</u></b> to read the [user guide](https://jwolpxeehx.feishu.cn/docx/RYHNd1tvEo8k8Mx9HeMcvvxWnvZ) before trying out this demo.</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-21 04:17
10
  # File Name : generation_frontend.py
11
  # Description :
12
  #
@@ -24,7 +24,7 @@ import gradio as gr
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
28
 
29
  CONTROLLER_URL = ""
30
 
@@ -160,6 +160,14 @@ def build_generation(args):
160
  with gr.Blocks(title="Emu", theme=gr.themes.Default(primary_hue="blue", secondary_hue="blue")) as demo:
161
  state = gr.State()
162
 
 
 
 
 
 
 
 
 
163
  with gr.Row():
164
  with gr.Column(scale=2):
165
  with gr.Row():
 
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-21 06:45
10
  # File Name : generation_frontend.py
11
  # Description :
12
  #
 
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, GUIDANCE, RECOMMEND
28
 
29
  CONTROLLER_URL = ""
30
 
 
160
  with gr.Blocks(title="Emu", theme=gr.themes.Default(primary_hue="blue", secondary_hue="blue")) as demo:
161
  state = gr.State()
162
 
163
+ gr.Markdown("<font size=5><center><b>Emu2</b> is capable of accepting 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(GUIDANCE)
165
+ gr.Markdown(RECOMMEND)
166
+ gr.Markdown("<font size=4>💡<b><u>Tips</b></u>💡:</font> To achieve better generation quality\n \
167
+ - If subject-driven generation does not follow the given prompt, randomly bind a central bounding box with the input image or text often helps resolve the issue.\n \
168
+ - In multi-object generation, it is recommended to specify location and object names(phrase) for better results.\n \
169
+ - The best results are achieved when the aspect ratio of the location box matches that of the original object.")
170
+
171
  with gr.Row():
172
  with gr.Column(scale=2):
173
  with gr.Row():