update README.md
This commit is contained in:
@@ -28,9 +28,7 @@ Request Body:
|
||||
"workflow": {Workflow JSON},
|
||||
"params": {
|
||||
"paramName": "paramValue"
|
||||
},
|
||||
"wait_for_result": true,
|
||||
"timeout": 300
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -43,7 +41,7 @@ To use dynamic parameters in your workflow, you need to use special markers in t
|
||||
|
||||
Examples:
|
||||
|
||||
- A LoadImage node marked with `$input_image` will use the input_image parameter from params as the image filename
|
||||
- A LoadImage node marked with `$input_image` will use the input_image parameter from params as the image param
|
||||
- A CLIPTextEncode node marked with `$prompt.text` will replace the text field with the prompt parameter from params
|
||||
|
||||
## Examples
|
||||
@@ -59,8 +57,7 @@ curl -X POST "http://localhost:8188/oneapi/v1/execute" \
|
||||
"workflow": '"$(cat workflows/example_workflow.json)"',
|
||||
"params": {
|
||||
"prompt": "a cute dog with a red hat"
|
||||
},
|
||||
"wait_for_result": true
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
@@ -75,8 +72,7 @@ curl -X POST "http://localhost:8188/oneapi/v1/execute" \
|
||||
"params": {
|
||||
"prompt": "a cute dog with a red hat",
|
||||
"image": "https://example.com/input.jpg"
|
||||
},
|
||||
"wait_for_result": true
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
|
||||
+4
-8
@@ -28,9 +28,7 @@ POST /oneapi/v1/execute
|
||||
"workflow": {工作流JSON},
|
||||
"params": {
|
||||
"参数名": "参数值"
|
||||
},
|
||||
"wait_for_result": true,
|
||||
"timeout": 300
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -43,7 +41,7 @@ POST /oneapi/v1/execute
|
||||
|
||||
例如:
|
||||
|
||||
- 标记为 `$input_image` 的LoadImage节点,将使用params中的input_image参数作为图片文件名
|
||||
- 标记为 `$input_image` 的LoadImage节点,将使用params中的input_image参数作为图片参数
|
||||
- 标记为 `$prompt.text` 的CLIPTextEncode节点,将使用params中的prompt参数替换text字段
|
||||
|
||||
## 示例
|
||||
@@ -59,8 +57,7 @@ curl -X POST "http://localhost:8188/oneapi/v1/execute" \
|
||||
"workflow": '"$(cat workflows/example_workflow.json)"',
|
||||
"params": {
|
||||
"prompt": "a cute dog with a red hat"
|
||||
},
|
||||
"wait_for_result": true
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
@@ -75,8 +72,7 @@ curl -X POST "http://localhost:8188/oneapi/v1/execute" \
|
||||
"params": {
|
||||
"prompt": "a cute dog with a red hat",
|
||||
"image": "https://example.com/input.jpg"
|
||||
},
|
||||
"wait_for_result": true
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ async def execute_workflow(request):
|
||||
workflow = data.get('workflow')
|
||||
params = data.get('params', {})
|
||||
wait_for_result = data.get('wait_for_result', True)
|
||||
timeout = data.get('timeout', 300)
|
||||
timeout = data.get('timeout', None)
|
||||
|
||||
if not workflow:
|
||||
return web.json_response({"error": "Workflow data is missing"}, status=400)
|
||||
@@ -320,7 +320,7 @@ async def _get_base_url(request):
|
||||
|
||||
return base_url
|
||||
|
||||
async def _wait_for_results(prompt_id, timeout=300, request=None):
|
||||
async def _wait_for_results(prompt_id, timeout=None, request=None):
|
||||
"""Wait for workflow execution results, get history using HTTP API"""
|
||||
start_time = time.time()
|
||||
result = {
|
||||
@@ -334,7 +334,7 @@ async def _wait_for_results(prompt_id, timeout=300, request=None):
|
||||
|
||||
while True:
|
||||
# Check timeout
|
||||
if timeout > 0 and (time.time() - start_time) > timeout:
|
||||
if timeout is not None and timeout > 0 and (time.time() - start_time) > timeout:
|
||||
result["status"] = "timeout"
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user