ryanzhangfan commited on
Commit
1658f28
1 Parent(s): 09fcab5

change some examples

Browse files
demo/chat_frontend.py CHANGED
@@ -6,7 +6,7 @@
6
  # Email : [email protected]
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-12 18:05
9
- # Last Modified : 2023-12-20 15:59
10
  # File Name : chat_frontend.py
11
  # Description :
12
  #
@@ -210,7 +210,7 @@ def build_chat(args):
210
  examples = gr.Dataset(components=[gr.Image(type="pil", visible=False), gr.Textbox(visible=False)],
211
  label="Examples",
212
  samples=[
213
- ["./examples/roadmap.jpg", "Imagine you are a guiding robot.\nHere is a photo I took. Please tell me how to get to the restroom."],
214
  ["./examples/shapes.jpeg", "Look at this sequence of three shapes. What shape should come as the fourth shape? Explain your reasoning with detailed descriptions of the first shapes."],
215
  ],
216
  )
 
6
  # Email : [email protected]
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-12 18:05
9
+ # Last Modified : 2023-12-20 17:15
10
  # File Name : chat_frontend.py
11
  # Description :
12
  #
 
210
  examples = gr.Dataset(components=[gr.Image(type="pil", visible=False), gr.Textbox(visible=False)],
211
  label="Examples",
212
  samples=[
213
+ ["./examples/squirrel.jpeg", "What is funny about this image?"],
214
  ["./examples/shapes.jpeg", "Look at this sequence of three shapes. What shape should come as the fourth shape? Explain your reasoning with detailed descriptions of the first shapes."],
215
  ],
216
  )
demo/generation_frontend.py CHANGED
@@ -6,7 +6,7 @@
6
  # Email : [email protected]
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-11 15:35
9
- # Last Modified : 2023-12-20 16:39
10
  # File Name : generation_frontend.py
11
  # Description :
12
  #
@@ -137,10 +137,13 @@ def push_examples(examples, meta):
137
  if len(examples) == 1:
138
  prompt, = examples
139
  meta.append(Role.USER, DataMeta.build(text=prompt))
140
- elif len(examples) == 2:
141
- image, prompt = examples
 
 
142
  meta.append(Role.USER, DataMeta.build(image=Image.open(image)))
143
- meta.append(Role.USER, DataMeta.build(text=prompt))
 
144
 
145
  return meta.format_chatbot(), meta
146
 
@@ -199,17 +202,18 @@ def build_generation(args):
199
 
200
  with gr.Row():
201
  examples_t2i = gr.Dataset(components=[gr.Textbox(visible=False)],
202
- label="Examples",
203
  samples=[
204
  ["impressionist painting of an astronaut in a jungle"],
205
  ["A poised woman with short, curly hair and a warm smile, dressed in elegant attire, standing in front of a historic stone bridge in a serene park at sunset."],
206
  ],
207
  )
208
  with gr.Row():
209
- examples_it2i = gr.Dataset(components=[gr.Image(type="pil", visible=False), gr.Textbox(visible=False)],
 
210
  samples=[
211
- ["./examples/dog2.jpg", "wearing a red hat on the beach."],
212
- ["./examples/balloon.webp", "floats above theforest"],
213
  ],
214
  )
215
 
 
6
  # Email : [email protected]
7
  # Institute : Beijing Academy of Artificial Intelligence (BAAI)
8
  # Create On : 2023-12-11 15:35
9
+ # Last Modified : 2023-12-20 17:16
10
  # File Name : generation_frontend.py
11
  # Description :
12
  #
 
137
  if len(examples) == 1:
138
  prompt, = examples
139
  meta.append(Role.USER, DataMeta.build(text=prompt))
140
+ elif len(examples) == 3:
141
+ p1, image, p2 = examples
142
+ if p1 is not None and p1 != "":
143
+ meta.append(Role.USER, DataMeta.build(text=p1))
144
  meta.append(Role.USER, DataMeta.build(image=Image.open(image)))
145
+ if p2 is not None and p2 != "":
146
+ meta.append(Role.USER, DataMeta.build(text=p2))
147
 
148
  return meta.format_chatbot(), meta
149
 
 
202
 
203
  with gr.Row():
204
  examples_t2i = gr.Dataset(components=[gr.Textbox(visible=False)],
205
+ label="Text-to-image Examples",
206
  samples=[
207
  ["impressionist painting of an astronaut in a jungle"],
208
  ["A poised woman with short, curly hair and a warm smile, dressed in elegant attire, standing in front of a historic stone bridge in a serene park at sunset."],
209
  ],
210
  )
211
  with gr.Row():
212
+ examples_it2i = gr.Dataset(components=[gr.Textbox(visible=False), gr.Image(type="pil", visible=False), gr.Textbox(visible=False)],
213
+ label="Image Editing Examples",
214
  samples=[
215
+ ["", "./examples/dog2.jpg", "make it oil painting style."],
216
+ ["An image of", "./examples/emu.png", "wearing a big sunglasses on the beach"]
217
  ],
218
  )
219
 
examples/balloon.webp DELETED
Binary file (9.68 kB)
 
examples/emu.png ADDED
examples/roadmap.jpg DELETED
Binary file (33 kB)
 
examples/squirrel.jpeg ADDED