Skip to content

Commit

Permalink
Background remover (modelscope#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
qbc2016 authored Sep 11, 2024
1 parent 2287365 commit f2a609e
Show file tree
Hide file tree
Showing 16 changed files with 1,074 additions and 61 deletions.
143 changes: 143 additions & 0 deletions gallery/remove_bg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"meta": {
"index": 2,
"title": "Background Remover",
"author": "AgentScopeTeam",
"keywords": [
"background",
"image"
],
"category": "tool",
"time": "2024-09-04",
"thumbnail": ""
},
"drawflow": {
"Home": {
"data": {
"2": {
"id": 2,
"name": "dashscope_image_synthesis",
"data": {
"args": {
"config_name": "wanx",
"model_name": "wanx-v1",
"generate_args": {
"n": 1,
"size": "1024*1024",
"temperature": 0,
"seed": 0
},
"model_type": "dashscope_image_synthesis",
"messages_key": "prompt",
"api_key": ""
}
},
"class": "dashscope_image_synthesis",
"typenode": false,
"inputs": {},
"outputs": {},
"pos_x": 24.88888888888889,
"pos_y": -12
},
"3": {
"id": 3,
"name": "TextToImageAgent",
"data": {
"args": {
"name": "人物头像生成器",
"model_config_name": "wanx"
}
},
"class": "TextToImageAgent",
"typenode": false,
"inputs": {
"input_1": {
"connections": [
{
"node": "4",
"input": "output_1"
}
]
}
},
"outputs": {
"output_1": {
"connections": [
{
"node": "5",
"output": "input_1"
}
]
}
},
"pos_x": 555,
"pos_y": 179
},
"4": {
"id": 4,
"name": "Message",
"data": {
"args": {
"name": "Host",
"content": "一个英俊帅气的男生,背景是森林",
"url": ""
}
},
"class": "Message",
"typenode": false,
"inputs": {
"input_1": {
"connections": []
}
},
"outputs": {
"output_1": {
"connections": [
{
"node": "3",
"output": "input_1"
}
]
}
},
"pos_x": 245.11111111111111,
"pos_y": 164
},
"5": {
"id": 5,
"name": "Post",
"data": {
"args": {
"url": "https://api.remove.bg/v1.0/removebg",
"image_path_or_url": "",
"headers": "{\"X-Api-Key\": \"\"}",
"data": "{\"size\": \"auto\"}",
"json": "{}",
"kwargs": "{}",
"output_path": "remove_bg.png"
}
},
"class": "Post",
"typenode": false,
"inputs": {
"input_1": {
"connections": [
{
"node": "3",
"input": "output_1"
}
]
}
},
"outputs": {
"output_1": {
"connections": []
}
},
"pos_x": 948,
"pos_y": -60
}
}
}
}
}
2 changes: 1 addition & 1 deletion gallery/story.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"meta": {
"index": 0,
"index": 3,
"title": "Story",
"author": "AgentScopeTeam",
"keywords": [
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
"flask_babel",
"babel==2.15.0",
"gunicorn",
"numpy",
"opencv-python-headless",
]

with open("README.md", "r", encoding="UTF-8") as fh:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<div class="title-box-left-items">
<svg class="title-box-svg" viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg">
<path d="M847.530667 361.173333a149.546667 149.546667 0 0 0-129.28-189.824A128.213333 128.213333 0 0 0 597.333333 85.333333a127.146667 127.146667 0 0 0-85.333333 33.28A127.146667 127.146667 0 0 0 426.666667 85.333333c-55.509333 0-102.826667 35.456-120.533334 85.973334a149.546667 149.546667 0 0 0-129.664 189.866666A171.861333 171.861333 0 0 0 85.333333 512c0 45.866667 18.261333 89.002667 50.005334 120.832A173.525333 173.525333 0 0 0 128 682.666667c0 83.498667 60.245333 153.173333 141.056 167.850666A149.973333 149.973333 0 0 0 405.333333 938.666667c41.770667 0 79.530667-17.365333 106.666667-45.184A148.650667 148.650667 0 0 0 618.666667 938.666667a149.76 149.76 0 0 0 136.106666-87.893334 170.922667 170.922667 0 0 0 133.888-217.941333A170.794667 170.794667 0 0 0 938.666667 512a171.861333 171.861333 0 0 0-91.136-150.826667zM405.333333 853.333333c-30.336 0-56.746667-21.504-62.72-51.114666L333.568 768H298.666667c-47.061333 0-85.333333-38.272-85.333334-85.333333 0-15.018667 3.626667-29.098667 10.794667-41.856l19.456-34.816-33.450667-21.76A86.144 86.144 0 0 1 170.666667 512c0-41.685333 30.848-77.824 71.765333-84.138667l72.234667-11.093333-45.184-57.429333a64.085333 64.085333 0 0 1 63.914666-101.973334L384 264.832V213.333333a42.666667 42.666667 0 0 1 85.333333 0v576c0 35.285333-28.714667 64-64 64z m408.533334-269.141333l-33.450667 21.76 19.456 34.816c7.168 12.8 10.794667 26.88 10.794667 41.898667 0 47.061333-38.272 85.333333-87.466667 85.333333h-34.901333l-6.912 34.218667A64.085333 64.085333 0 0 1 618.666667 853.333333c-35.285333 0-64-28.714667-64-64V213.333333c0-23.552 19.114667-42.666667 42.666666-42.666666s42.666667 19.114667 42.666667 44.8v51.498666l50.602667-9.6a64.085333 64.085333 0 0 1 63.914666 101.973334l-45.184 57.472 72.234667 11.093333A85.418667 85.418667 0 0 1 853.333333 512c0 29.141333-14.762667 56.106667-39.466666 72.192z"></path>
<path d="M258.56 869.546667a106.666667 106.666667 0 0 1-75.093333-180.906667l288.426666-288.213333A202.24 202.24 0 0 1 768 177.066667a21.333333 21.333333 0 0 1 10.666667 15.573333 21.333333 21.333333 0 0 1-6.186667 18.133333l-99.84 99.84 38.186667 38.186667L810.666667 248.96a21.333333 21.333333 0 0 1 33.493333 4.48 203.093333 203.093333 0 0 1-32.853333 243.2 202.666667 202.666667 0 0 1-190.506667 53.76L333.44 838.613333a105.386667 105.386667 0 0 1-74.88 30.933334zM668.8 193.493333a159.786667 159.786667 0 0 0-152.533333 207.786667 21.333333 21.333333 0 0 1-6.826667 23.04l-2.773333 2.133333-2.346667 1.706667L213.333333 718.933333a64 64 0 0 0 0 89.386667 64 64 0 0 0 89.386667 0l291.2-290.56a9.386667 9.386667 0 0 0 1.706667-2.346667L597.333333 512a21.333333 21.333333 0 0 1 23.04-7.04 159.786667 159.786667 0 0 0 199.04-205.013333l-93.226666 93.226666a21.333333 21.333333 0 0 1-30.08 0l-68.48-68.48a21.333333 21.333333 0 0 1-6.186667-14.933333 21.333333 21.333333 0 0 1 6.186667-15.146667l93.226666-93.226666a158.506667 158.506667 0 0 0-52.053333-7.893334z"></path>
<path d="M284.8 760.533333a21.333333 21.333333 0 0 1-15.146667-36.266666l181.76-181.76a21.333333 21.333333 0 0 1 30.293334 0 21.333333 21.333333 0 0 1 0 30.08l-181.76 181.76a21.333333 21.333333 0 0 1-15.146667 6.186666z"></path>
</svg>
<span>Image composition</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div class="title-box" data-class="POST">
<div class="title-box-left-items">
<svg class="title-box-svg" viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg">
<path d="M258.56 869.546667a106.666667 106.666667 0 0 1-75.093333-180.906667l288.426666-288.213333A202.24 202.24 0 0 1 768 177.066667a21.333333 21.333333 0 0 1 10.666667 15.573333 21.333333 21.333333 0 0 1-6.186667 18.133333l-99.84 99.84 38.186667 38.186667L810.666667 248.96a21.333333 21.333333 0 0 1 33.493333 4.48 203.093333 203.093333 0 0 1-32.853333 243.2 202.666667 202.666667 0 0 1-190.506667 53.76L333.44 838.613333a105.386667 105.386667 0 0 1-74.88 30.933334zM668.8 193.493333a159.786667 159.786667 0 0 0-152.533333 207.786667 21.333333 21.333333 0 0 1-6.826667 23.04l-2.773333 2.133333-2.346667 1.706667L213.333333 718.933333a64 64 0 0 0 0 89.386667 64 64 0 0 0 89.386667 0l291.2-290.56a9.386667 9.386667 0 0 0 1.706667-2.346667L597.333333 512a21.333333 21.333333 0 0 1 23.04-7.04 159.786667 159.786667 0 0 0 199.04-205.013333l-93.226666 93.226666a21.333333 21.333333 0 0 1-30.08 0l-68.48-68.48a21.333333 21.333333 0 0 1-6.186667-14.933333 21.333333 21.333333 0 0 1 6.186667-15.146667l93.226666-93.226666a158.506667 158.506667 0 0 0-52.053333-7.893334z"></path>
<path d="M284.8 760.533333a21.333333 21.333333 0 0 1-15.146667-36.266666l181.76-181.76a21.333333 21.333333 0 0 1 30.293334 0 21.333333 21.333333 0 0 1 0 30.08l-181.76 181.76a21.333333 21.333333 0 0 1-15.146667 6.186666z"></path>
</svg>
<span>Image Motion</span>
</div>
<span class="toggle-arrow">&#x25B2;</span>
</div>
<div class="box">
<div class="readme">Image Motion Configurations</div>
<br>

<label> Output path </label>
<textarea type="text" df-args-output_path class="text-input"
placeholder="/Users/xxxx/Desktop/res.mp4"> </textarea><br>

<label for="output_format_select">Output Format</label>
<select id="output_format_select" df-args-output_format
data-required="true">
<option value="mp4" selected>MP4</option>
<option value="gif">GIF</option>
</select>

<label> Duration </label>
<input type="number" df-args-duration placeholder=5 min="1"><br>

<label for="motion_style_select">Motion direction</label>
<select id="motion_style_select" df-args-motion_style
data-required="true">
<option value="random" selected>Random</option>
<option value="left">Left</option>
<option value="right">Right</option>
<option value="zoom_out">Zoom out</option>
<option value="zoom_in">Zoom in</option>
</select>

</div>
47 changes: 47 additions & 0 deletions src/agentscope/studio/static/html-drag-components/tool-post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<div class="title-box" data-class="POST">
<div class="title-box-left-items">
<svg class="title-box-svg" viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg">
<path d="M258.56 869.546667a106.666667 106.666667 0 0 1-75.093333-180.906667l288.426666-288.213333A202.24 202.24 0 0 1 768 177.066667a21.333333 21.333333 0 0 1 10.666667 15.573333 21.333333 21.333333 0 0 1-6.186667 18.133333l-99.84 99.84 38.186667 38.186667L810.666667 248.96a21.333333 21.333333 0 0 1 33.493333 4.48 203.093333 203.093333 0 0 1-32.853333 243.2 202.666667 202.666667 0 0 1-190.506667 53.76L333.44 838.613333a105.386667 105.386667 0 0 1-74.88 30.933334zM668.8 193.493333a159.786667 159.786667 0 0 0-152.533333 207.786667 21.333333 21.333333 0 0 1-6.826667 23.04l-2.773333 2.133333-2.346667 1.706667L213.333333 718.933333a64 64 0 0 0 0 89.386667 64 64 0 0 0 89.386667 0l291.2-290.56a9.386667 9.386667 0 0 0 1.706667-2.346667L597.333333 512a21.333333 21.333333 0 0 1 23.04-7.04 159.786667 159.786667 0 0 0 199.04-205.013333l-93.226666 93.226666a21.333333 21.333333 0 0 1-30.08 0l-68.48-68.48a21.333333 21.333333 0 0 1-6.186667-14.933333 21.333333 21.333333 0 0 1 6.186667-15.146667l93.226666-93.226666a158.506667 158.506667 0 0 0-52.053333-7.893334z"></path>
<path d="M284.8 760.533333a21.333333 21.333333 0 0 1-15.146667-36.266666l181.76-181.76a21.333333 21.333333 0 0 1 30.293334 0 21.333333 21.333333 0 0 1 0 30.08l-181.76 181.76a21.333333 21.333333 0 0 1-15.146667 6.186666z"></path>
</svg>
<span>Post</span>
</div>
<span class="toggle-arrow">&#x25B2;</span>
</div>
<div class="box">
<div class="readme">Post Configurations</div>
<br>
<label> url </label>
<input type="text" df-args-url placeholder=""
data-required="true"><br>

<label> Headers </label>
<textarea type="text" df-args-headers class="text-input"
placeholder='{"xx": "xxx"}'> </textarea><br>

<label> Data </label>
<textarea type="text" df-args-data class="text-input"
placeholder='{"xx": "xxx"}'> </textarea><br>

<label> Json </label>
<textarea type="text" df-args-json class="text-input"
placeholder='{"xx": "xxx"}'> </textarea><br>

<label> Kwargs </label>
<textarea type="text" df-args-kwargs class="text-input"
placeholder='{"xx": "xxx"}'> </textarea><br>

<label> Output path </label>
<textarea type="text" df-args-output_path class="text-input"
placeholder="/Users/xxxx/Desktop/res.jpg"> </textarea><br>

<label for="output_type_select">Output type</label>
<select id="output_type_select" df-args-output_type
data-required="true">
<option value="image" selected>Image</option>
<option value="text">Text</option>
<option value="audio">Audio</option>
<option value="video">Video</option>
</select>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="title-box" data-class="POST">
<div class="title-box-left-items">
<svg class="title-box-svg" viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg">
<path d="M258.56 869.546667a106.666667 106.666667 0 0 1-75.093333-180.906667l288.426666-288.213333A202.24 202.24 0 0 1 768 177.066667a21.333333 21.333333 0 0 1 10.666667 15.573333 21.333333 21.333333 0 0 1-6.186667 18.133333l-99.84 99.84 38.186667 38.186667L810.666667 248.96a21.333333 21.333333 0 0 1 33.493333 4.48 203.093333 203.093333 0 0 1-32.853333 243.2 202.666667 202.666667 0 0 1-190.506667 53.76L333.44 838.613333a105.386667 105.386667 0 0 1-74.88 30.933334zM668.8 193.493333a159.786667 159.786667 0 0 0-152.533333 207.786667 21.333333 21.333333 0 0 1-6.826667 23.04l-2.773333 2.133333-2.346667 1.706667L213.333333 718.933333a64 64 0 0 0 0 89.386667 64 64 0 0 0 89.386667 0l291.2-290.56a9.386667 9.386667 0 0 0 1.706667-2.346667L597.333333 512a21.333333 21.333333 0 0 1 23.04-7.04 159.786667 159.786667 0 0 0 199.04-205.013333l-93.226666 93.226666a21.333333 21.333333 0 0 1-30.08 0l-68.48-68.48a21.333333 21.333333 0 0 1-6.186667-14.933333 21.333333 21.333333 0 0 1 6.186667-15.146667l93.226666-93.226666a158.506667 158.506667 0 0 0-52.053333-7.893334z"></path>
<path d="M284.8 760.533333a21.333333 21.333333 0 0 1-15.146667-36.266666l181.76-181.76a21.333333 21.333333 0 0 1 30.293334 0 21.333333 21.333333 0 0 1 0 30.08l-181.76 181.76a21.333333 21.333333 0 0 1-15.146667 6.186666z"></path>
</svg>
<span>Video composition</span>
</div>
<span class="toggle-arrow">&#x25B2;</span>
</div>
<div class="box">
<div class="readme">Video composition Configurations</div>
<br>

<label> Output path </label>
<textarea type="text" df-args-output_path class="text-input"
placeholder="/Users/xxxx/Desktop/res.mp4"> </textarea><br>

<label> Target Video Width </label>
<input type="text" df-args-target_width placeholder="Optional">
<br>

<label> Target Video Height </label>
<input type="text" df-args-target_height placeholder="Optional">
<br>

<label> Target Video Fps </label>
<input type="text" df-args-target_fps placeholder="Optional">
<br>

</div>
Loading

0 comments on commit f2a609e

Please sign in to comment.