diff --git a/applications/CVinW/README.md b/applications/CVinW/README.md index 84e94629400a1..3b4aec1c0cbf1 100644 --- a/applications/CVinW/README.md +++ b/applications/CVinW/README.md @@ -5,7 +5,7 @@ `Grounded-SAM` 示例: ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow from PIL import Image task = Appflow(app="openset_det_sam", models=["GroundingDino/groundingdino-swint-ogc","Sam/SamVitH-1024"] diff --git a/applications/Inpainting/README.md b/applications/Inpainting/README.md index 27ae96489e331..78e8c56fcf955 100644 --- a/applications/Inpainting/README.md +++ b/applications/Inpainting/README.md @@ -5,7 +5,7 @@ `Grounded-SAM-Inpainting` 示例: ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow from PIL import Image task = Appflow(app="inpainting", models=["GroundingDino/groundingdino-swint-ogc","Sam/SamVitH-1024","stabilityai/stable-diffusion-2-inpainting"] @@ -27,14 +27,19 @@ result = task(image=image_pil,prompt="bus",inpaint_prompt="a yellow van") `Grounded-SAM-chatglm` 示例: ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow from PIL import Image task = Appflow(app="inpainting", models=["THUDM/chatglm-6b","GroundingDino/groundingdino-swint-ogc","Sam/SamVitH-1024","stabilityai/stable-diffusion-2-inpainting"] ) paddle.seed(1024) image_pil = Image.open("bus.png").convert("RGB") -result = task(image=image_pil,inpaint_prompt="bus is changed to A school bus parked on the roadside") +inpaint_prompt = "bus is changed to A school bus parked on the roadside" +prompt = "Given caption,extract the main object to be replaced and marked it as 'main_object'," \ + + "Extract the remaining part as 'other prompt', " \ + + "Return main_object, other prompt in English" \ + + "Given caption: {}.".format(inpaint_prompt) +result = task(image=image_pil,prompt=prompt) ``` 一些效果展示 @@ -50,7 +55,7 @@ result = task(image=image_pil,inpaint_prompt="bus is changed to A school bus par ### 文本引导的图像编辑(Text-Guided Image Inpainting) ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow from PIL import Image from ppdiffusers.utils import load_image img_url = "https://paddlenlp.bj.bcebos.com/models/community/CompVis/stable-diffusion-v1-4/overture-creations.png" @@ -75,6 +80,3 @@ image.save("a_yellow_cat.png") | ![overture-creations](https://github.com/LokeZhou/PaddleMIX/assets/13300429/fe13b5f6-e773-41c2-9660-3b2747575fc1) | Face of a yellow cat, high resolution, sitting on a park bench|![overture-creations-mask](https://github.com/LokeZhou/PaddleMIX/assets/13300429/8c3dbb3a-5a32-4c22-b66e-7b82fcd18b77) |![a_yellow_cat](https://github.com/LokeZhou/PaddleMIX/assets/13300429/094ba90a-35c0-4a50-ac1f-6e0ce91ea931) | - - - diff --git a/applications/README.md b/applications/README.md index a083e877fd388..ff796a2a99f15 100644 --- a/applications/README.md +++ b/applications/README.md @@ -31,7 +31,7 @@ Appflow提供丰富的开箱即用工具集,覆盖跨模态多场景应用,提供产业级的效果与极致的推理性能。 ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow paddle.seed(1024) task = Appflow(app="text2image_generation", @@ -71,7 +71,10 @@ pip install -r requirements.txt ```shell git clone https://github.com/PaddlePaddle/PaddleMIX -python setup.py install +pip install -e . + +#appflow 依赖包安装 +pip install -r paddlemix/appflow/requirements.txt ``` ## 快速开始 @@ -82,7 +85,7 @@ python setup.py install PaddleMIX提供一键预测功能,无需训练,直接输入数据即可输出结果: ```python ->>> from paddlemix import Appflow +>>> from paddlemix.appflow import Appflow >>> from ppdiffusers.utils import load_image >>> task = Appflow(task="openset_det_sam", diff --git a/applications/README_en.md b/applications/README_en.md index a007e76eaa6b4..2d44c5ae2cab0 100644 --- a/applications/README_en.md +++ b/applications/README_en.md @@ -31,7 +31,7 @@ Appflow provides a rich set of out of the box tools that cover cross modal and multi scenario applications, providing industry level effects and ultimate reasoning performance. ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow paddle.seed(1024) task = Appflow(app="text2image_generation", @@ -71,7 +71,10 @@ For more detailed tutorials on PaddlePaddle and PaddleNLP installation, please r ```shell git clone https://github.com/PaddlePaddle/PaddleMIX -python setup.py install +pip install -e . + +#appflow requirements +pip install -r paddlemix/appflow/requirements.txt ``` ## Quick Start @@ -82,7 +85,7 @@ Taking open world detection segmentation as an example: PaddleMIX provides Appflow without training, and can directly input data to output results: ```python ->>> from paddlemix import Appflow +>>> from paddlemix.appflow import Appflow >>> from ppdiffusers.utils import load_image >>> task = Appflow(task="openset_det_sam", diff --git a/applications/image2image/README.md b/applications/image2image/README.md index 4f77cbaa28d19..77e9f0ebc201d 100644 --- a/applications/image2image/README.md +++ b/applications/image2image/README.md @@ -1,7 +1,7 @@ ### 文本引导的图像放大(Text-Guided Image Upscaling) ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow from PIL import Image from ppdiffusers.utils import load_image @@ -32,7 +32,7 @@ image.save("upscaled_white_cat.png") ### 文本图像双引导图像生成(Dual Text and Image Guided Generation) ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow from PIL import Image from ppdiffusers.utils import load_image diff --git a/applications/image2text/README.md b/applications/image2text/README.md index 0d75601493795..6f29fc7342a7c 100644 --- a/applications/image2text/README.md +++ b/applications/image2text/README.md @@ -26,7 +26,7 @@ ``` 完成之后,可使用appflow 一键预测 ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow import requests task = Appflow(app="image2text_generation", @@ -49,7 +49,7 @@ result = task(image=image,minigpt4_text=minigpt4_text) ## blip2 ```python -from paddlemix import Appflow +from paddlemix.appflow import Appflow from ppdiffusers.utils import load_image task = Appflow(app="image2text_generation", @@ -64,4 +64,3 @@ result = task(image=image_pil,blip2_prompt=blip2_prompt) |:----:|:----:|:----:| |![mugs](https://github.com/LokeZhou/PaddleMIX/assets/13300429/b5a95002-bb30-4683-8e62-ed21879f24e1) | describe the image|of the two coffee mugs with cats on them| - diff --git a/paddlemix/__init__.py b/paddlemix/__init__.py index cc8389889927e..058cfa738ac12 100644 --- a/paddlemix/__init__.py +++ b/paddlemix/__init__.py @@ -13,7 +13,6 @@ # see the license for the specific language governing permissions and # limitations under the license. -from .appflow import * from .datasets import * from .models import * from .optimization import * diff --git a/paddlemix/appflow/requirements.txt b/paddlemix/appflow/requirements.txt new file mode 100644 index 0000000000000..15fcd14256871 --- /dev/null +++ b/paddlemix/appflow/requirements.txt @@ -0,0 +1,5 @@ +numpy==1.23.5 +nltk +paddlenlp>=2.6.0rc0 +paddlespeech + diff --git a/requirements.txt b/requirements.txt index d5e325ba27937..733f0529cf7bd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ numpy -nltk paddlenlp>=2.6.0rc0 tensorboardX opencv-python