Skip to content

Commit 4ec0492

Browse files
authored
Merge pull request #62 from modelscope/v1.2.0_dev
update chatbot example
2 parents 02c0ba9 + aac85fa commit 4ec0492

File tree

3 files changed

+75
-45
lines changed

3 files changed

+75
-45
lines changed

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SCEPTER offers 3 core components:
1818

1919

2020
## 🎉 News
21-
- [🔥🔥🔥2024.10]: We are pleased to announce the release of the code for [ACE](https://arxiv.org/abs/2410.00086), supporting Customized Training / Comfy UI Workflow / gradio-based ChatBot Interface. The corresponding checkpoints are uploaded on [ModelScope](https://www.modelscope.cn/models/iic/ACE-0.6B-512px) and [HuggingFace](https://huggingface.co/scepter-studio/ACE-0.6B-512px). The detailed documents can be found at [ACE repo (soon)]().
21+
- [🔥🔥🔥2024.10]: We are pleased to announce the release of the code for [ACE](https://arxiv.org/abs/2410.00086), supporting Customized Training / Comfy UI Workflow / gradio-based ChatBot Interface. The detailed documents can be found at [ACE repo](https://github.com/ali-vilab/ACE.git).
2222
- [2024.10]: Support for inference and tuning with [FLUX](https://huggingface.co/black-forest-labs/FLUX.1-dev), as well as for building [ComfyUI](https://github.com/comfyanonymous/ComfyUI) workflows using this framework.
2323
- [2024.09]: We introduce **ACE**, an **A**ll-round **C**reator and **E**ditor adept at executing a diverse array of image editing tasks tailored to your specifications. Built upon the cutting-edge Diffusion Transformer architecture, ACE has been extensively trained on a comprehensive dataset to seamlessly interpret and execute any natural language instruction. For further information, please consult the [project page](https://ali-vilab.github.io/ace-page/).
2424
- [2024.07]: Support the inference and training of open-source generative models based on the [DiT](https://arxiv.org/abs/2212.09748) architecture, such as [SD3](https://arxiv.org/pdf/2403.03206) and [PixArt](https://arxiv.org/abs/2310.00426).

scepter/studio/chatbot/chatbot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,11 @@ def create_ui(self):
391391
2. Enter '@' in the text box will exhibit all images in the gallery.
392392
3. Select the image you wish to edit from the gallery, and its Image ID will be displayed in the text box.
393393
4. Compose the editing instruction for the selected image, incorporating image id '@xxxxxx' into your instruction.
394-
For example, you might say, "Change the girl's skirt in @123456 to blue." The '@xxxxx' token will facilitate the identification of the specific image, and will be automatically replaced by a special token '{image}' in the instruction.
394+
For example, you might say, "Change the girl's skirt in @123456 to blue." The '@xxxxx' token will facilitate the identification of the specific image, and will be automatically replaced by a special token '{image}' in the instruction. Furthermore, it is also possible to engage in text-to-image generation without any initial image input.
395395
5. Once your instructions are prepared, please click the "Chat" button to view the edited result in the chat window.
396396
6. **Important** To render text on an image, please ensure to include a space between each letter. For instance, "add text 'g i r l' on the mask area of @xxxxx".
397+
7. To implement local editing based on a specified mask, simply click on the image within the chat window to access the image editor. Here, you can draw a mask and then click the 'Submit' button to upload the edited image along with the mask. For inpainting tasks, select the 'Composite' mask type, while for outpainting tasks, choose the 'Outpainting' mask type. For all other local editing tasks, please select the 'Background' mask type.
398+
8. If you find our work valuable, we invite you to refer to the [ACE Page](https://ali-vilab.github.io/ace-page/) for comprehensive information.
397399
398400
"""
399401
gr.Markdown(value=inst)

scepter/studio/chatbot/example.py

Lines changed: 71 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,77 @@ def download_image(image, local_path=None):
1414
def get_examples(cache_dir):
1515
print('Downloading Examples ...')
1616
examples = [
17+
[
18+
'Facial Editing',
19+
download_image(
20+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/e33edc106953.png?raw=true',
21+
os.path.join(cache_dir, 'examples/e33edc106953.png')), None,
22+
None, '{image} let the man smile', 6666
23+
],
24+
[
25+
'Facial Editing',
26+
download_image(
27+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/5d2bcc91a3e9.png?raw=true',
28+
os.path.join(cache_dir, 'examples/5d2bcc91a3e9.png')), None,
29+
None, 'let the man in {image} wear sunglasses', 9999
30+
],
31+
[
32+
'Facial Editing',
33+
download_image(
34+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/3a52eac708bd.png?raw=true',
35+
os.path.join(cache_dir, 'examples/3a52eac708bd.png')), None,
36+
None, '{image} red hair', 9999
37+
],
38+
[
39+
'Facial Editing',
40+
download_image(
41+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/3f4dc464a0ea.png?raw=true',
42+
os.path.join(cache_dir, 'examples/3f4dc464a0ea.png')), None,
43+
None, '{image} let the man serious', 99999
44+
],
45+
[
46+
'Controllable Generation',
47+
download_image(
48+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/131ca90fd2a9.png?raw=true',
49+
os.path.join(cache_dir,
50+
'examples/131ca90fd2a9.png')), None, None,
51+
'"A person sits contemplatively on the ground, surrounded by falling autumn leaves. Dressed in a green sweater and dark blue pants, they rest their chin on their hand, exuding a relaxed demeanor. Their stylish checkered slip-on shoes add a touch of flair, while a black purse lies in their lap. The backdrop of muted brown enhances the warm, cozy atmosphere of the scene." , generate the image that corresponds to the given scribble {image}.',
52+
613725
53+
],
54+
[
55+
'Render Text',
56+
download_image(
57+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48.png?raw=true',
58+
os.path.join(cache_dir, 'examples/33e9f27c2c48.png')),
59+
download_image(
60+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48_mask.png?raw=true',
61+
os.path.join(cache_dir,
62+
'examples/33e9f27c2c48_mask.png')), None,
63+
'Put the text "C A T" at the position marked by mask in the {image}',
64+
6666
65+
],
66+
[
67+
'Style Transfer',
68+
download_image(
69+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/9e73e7eeef55.png?raw=true',
70+
os.path.join(cache_dir, 'examples/9e73e7eeef55.png')), None,
71+
download_image(
72+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/2e02975293d6.png?raw=true',
73+
os.path.join(cache_dir, 'examples/2e02975293d6.png')),
74+
'edit {image} based on the style of {image1} ', 99999
75+
],
76+
[
77+
'Outpainting',
78+
download_image(
79+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f.png?raw=true',
80+
os.path.join(cache_dir, 'examples/f2b22c08be3f.png')),
81+
download_image(
82+
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f_mask.png?raw=true',
83+
os.path.join(cache_dir,
84+
'examples/f2b22c08be3f_mask.png')), None,
85+
'Could the {image} be widened within the space designated by mask, while retaining the original?',
86+
6666
87+
],
1788
[
1889
'Image Segmentation',
1990
download_image(
@@ -135,15 +206,6 @@ def get_examples(cache_dir):
135206
'creating a vivid image based on {image} and description "This image features a delicious rectangular tart with a flaky, golden-brown crust. The tart is topped with evenly sliced tomatoes, layered over a creamy cheese filling. Aromatic herbs are sprinkled on top, adding a touch of green and enhancing the visual appeal. The background includes a soft, textured fabric and scattered white flowers, creating an elegant and inviting presentation. Bright red tomatoes in the upper right corner hint at the fresh ingredients used in the dish."',
136207
6666
137208
],
138-
[
139-
'Controllable Generation',
140-
download_image(
141-
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/131ca90fd2a9.png?raw=true',
142-
os.path.join(cache_dir,
143-
'examples/131ca90fd2a9.png')), None, None,
144-
'"A person sits contemplatively on the ground, surrounded by falling autumn leaves. Dressed in a green sweater and dark blue pants, they rest their chin on their hand, exuding a relaxed demeanor. Their stylish checkered slip-on shoes add a touch of flair, while a black purse lies in their lap. The backdrop of muted brown enhances the warm, cozy atmosphere of the scene." , generate the image that corresponds to the given scribble {image}.',
145-
613725
146-
],
147209
[
148210
'Image Denoising',
149211
download_image(
@@ -177,18 +239,6 @@ def get_examples(cache_dir):
177239
'Refashion the mask portion of {image} in accordance with "A yellow egg with a smiling face painted on it"',
178240
6666
179241
],
180-
[
181-
'Outpainting',
182-
download_image(
183-
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f.png?raw=true',
184-
os.path.join(cache_dir, 'examples/f2b22c08be3f.png')),
185-
download_image(
186-
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f_mask.png?raw=true',
187-
os.path.join(cache_dir,
188-
'examples/f2b22c08be3f_mask.png')), None,
189-
'Could the {image} be widened within the space designated by mask, while retaining the original?',
190-
6666
191-
],
192242
[
193243
'General Editing',
194244
download_image(
@@ -230,18 +280,6 @@ def get_examples(cache_dir):
230280
os.path.join(cache_dir, 'examples/92751f2e4a0e.png')), None,
231281
None, '{image} Remove the smile from his face', 9899999
232282
],
233-
[
234-
'Render Text',
235-
download_image(
236-
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48.png?raw=true',
237-
os.path.join(cache_dir, 'examples/33e9f27c2c48.png')),
238-
download_image(
239-
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48_mask.png?raw=true',
240-
os.path.join(cache_dir,
241-
'examples/33e9f27c2c48_mask.png')), None,
242-
'Put the text "C A T" at the position marked by mask in the {image}',
243-
6666
244-
],
245283
[
246284
'Remove Text',
247285
download_image(
@@ -304,16 +342,6 @@ def get_examples(cache_dir):
304342
os.path.join(cache_dir, 'examples/e0f48b3fd010.png')), None,
305343
None, 'make {image} to Walt Disney Animation style', 99999
306344
],
307-
[
308-
'Style Transfer',
309-
download_image(
310-
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/9e73e7eeef55.png?raw=true',
311-
os.path.join(cache_dir, 'examples/9e73e7eeef55.png')), None,
312-
download_image(
313-
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/2e02975293d6.png?raw=true',
314-
os.path.join(cache_dir, 'examples/2e02975293d6.png')),
315-
'edit {image} based on the style of {image1} ', 99999
316-
],
317345
[
318346
'Try On',
319347
download_image(

0 commit comments

Comments
 (0)