feat: add xinference sd web ui api tool (#8385)
Signed-off-by: themanforfree <themanforfree@gmail.com>pull/8710/head
parent
7f1b028840
commit
21e9608b23
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
@ -0,0 +1,87 @@
|
|||||||
|
identity:
|
||||||
|
name: stable_diffusion
|
||||||
|
author: xinference
|
||||||
|
label:
|
||||||
|
en_US: Stable Diffusion
|
||||||
|
zh_Hans: Stable Diffusion
|
||||||
|
description:
|
||||||
|
human:
|
||||||
|
en_US: Generate images using Stable Diffusion models.
|
||||||
|
zh_Hans: 使用 Stable Diffusion 模型生成图片。
|
||||||
|
llm: draw the image you want based on your prompt.
|
||||||
|
parameters:
|
||||||
|
- name: prompt
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
label:
|
||||||
|
en_US: Prompt
|
||||||
|
zh_Hans: 提示词
|
||||||
|
human_description:
|
||||||
|
en_US: Image prompt
|
||||||
|
zh_Hans: 图像提示词
|
||||||
|
llm_description: Image prompt of Stable Diffusion, you should describe the image you want to generate as a list of words as possible as detailed, the prompt must be written in English.
|
||||||
|
form: llm
|
||||||
|
- name: model
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
label:
|
||||||
|
en_US: Model Name
|
||||||
|
zh_Hans: 模型名称
|
||||||
|
human_description:
|
||||||
|
en_US: Model Name
|
||||||
|
zh_Hans: 模型名称
|
||||||
|
form: form
|
||||||
|
- name: lora
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
label:
|
||||||
|
en_US: Lora
|
||||||
|
zh_Hans: Lora
|
||||||
|
human_description:
|
||||||
|
en_US: Lora
|
||||||
|
zh_Hans: Lora
|
||||||
|
form: form
|
||||||
|
- name: steps
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
label:
|
||||||
|
en_US: Steps
|
||||||
|
zh_Hans: Steps
|
||||||
|
human_description:
|
||||||
|
en_US: Steps
|
||||||
|
zh_Hans: Steps
|
||||||
|
form: form
|
||||||
|
default: 10
|
||||||
|
- name: width
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
label:
|
||||||
|
en_US: Width
|
||||||
|
zh_Hans: Width
|
||||||
|
human_description:
|
||||||
|
en_US: Width
|
||||||
|
zh_Hans: Width
|
||||||
|
form: form
|
||||||
|
default: 1024
|
||||||
|
- name: height
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
label:
|
||||||
|
en_US: Height
|
||||||
|
zh_Hans: Height
|
||||||
|
human_description:
|
||||||
|
en_US: Height
|
||||||
|
zh_Hans: Height
|
||||||
|
form: form
|
||||||
|
default: 1024
|
||||||
|
- name: negative_prompt
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
label:
|
||||||
|
en_US: Negative prompt
|
||||||
|
zh_Hans: Negative prompt
|
||||||
|
human_description:
|
||||||
|
en_US: Negative prompt
|
||||||
|
zh_Hans: Negative prompt
|
||||||
|
form: form
|
||||||
|
default: bad art, ugly, deformed, watermark, duplicated, discontinuous lines
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
from core.tools.errors import ToolProviderCredentialValidationError
|
||||||
|
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
|
||||||
|
|
||||||
|
|
||||||
|
class XinferenceProvider(BuiltinToolProviderController):
|
||||||
|
def _validate_credentials(self, credentials: dict) -> None:
|
||||||
|
base_url = credentials.get("base_url")
|
||||||
|
api_key = credentials.get("api_key")
|
||||||
|
model = credentials.get("model")
|
||||||
|
res = requests.post(
|
||||||
|
f"{base_url}/sdapi/v1/options",
|
||||||
|
headers={"Authorization": f"Bearer {api_key}"},
|
||||||
|
json={"sd_model_checkpoint": model},
|
||||||
|
)
|
||||||
|
if res.status_code != 200:
|
||||||
|
raise ToolProviderCredentialValidationError("Xinference API key is invalid")
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
identity:
|
||||||
|
author: xinference
|
||||||
|
name: xinference
|
||||||
|
label:
|
||||||
|
en_US: Xinference
|
||||||
|
zh_Hans: Xinference
|
||||||
|
description:
|
||||||
|
zh_Hans: Xinference 提供的兼容 Stable Diffusion web ui 的图片生成 API。
|
||||||
|
en_US: Stable Diffusion web ui compatible API provided by Xinference.
|
||||||
|
icon: icon.png
|
||||||
|
tags:
|
||||||
|
- image
|
||||||
|
credentials_for_provider:
|
||||||
|
base_url:
|
||||||
|
type: secret-input
|
||||||
|
required: true
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_Hans: Xinference 服务器的 Base URL
|
||||||
|
placeholder:
|
||||||
|
en_US: Please input Xinference server's Base URL
|
||||||
|
zh_Hans: 请输入 Xinference 服务器的 Base URL
|
||||||
|
model:
|
||||||
|
type: text-input
|
||||||
|
required: true
|
||||||
|
label:
|
||||||
|
en_US: Model
|
||||||
|
zh_Hans: 模型
|
||||||
|
placeholder:
|
||||||
|
en_US: Please input your model name
|
||||||
|
zh_Hans: 请输入你的模型名称
|
||||||
|
api_key:
|
||||||
|
type: secret-input
|
||||||
|
required: true
|
||||||
|
label:
|
||||||
|
en_US: API Key
|
||||||
|
zh_Hans: Xinference 服务器的 API Key
|
||||||
|
placeholder:
|
||||||
|
en_US: Please input Xinference server's API Key
|
||||||
|
zh_Hans: 请输入 Xinference 服务器的 API Key
|
||||||
Loading…
Reference in New Issue