Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
b5819d9b
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1746
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b5819d9b
编写于
1月 02, 2023
作者:
P
Philpax
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(api): add /sdapi/v1/embeddings
上级
311354c0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
0 deletion
+11
-0
modules/api/api.py
modules/api/api.py
+8
-0
modules/api/models.py
modules/api/models.py
+3
-0
未找到文件。
modules/api/api.py
浏览文件 @
b5819d9b
...
...
@@ -100,6 +100,7 @@ class Api:
self
.
add_api_route
(
"/sdapi/v1/prompt-styles"
,
self
.
get_prompt_styles
,
methods
=
[
"GET"
],
response_model
=
List
[
PromptStyleItem
])
self
.
add_api_route
(
"/sdapi/v1/artist-categories"
,
self
.
get_artists_categories
,
methods
=
[
"GET"
],
response_model
=
List
[
str
])
self
.
add_api_route
(
"/sdapi/v1/artists"
,
self
.
get_artists
,
methods
=
[
"GET"
],
response_model
=
List
[
ArtistItem
])
self
.
add_api_route
(
"/sdapi/v1/embeddings"
,
self
.
get_embeddings
,
methods
=
[
"GET"
],
response_model
=
EmbeddingsResponse
)
self
.
add_api_route
(
"/sdapi/v1/refresh-checkpoints"
,
self
.
refresh_checkpoints
,
methods
=
[
"POST"
])
self
.
add_api_route
(
"/sdapi/v1/create/embedding"
,
self
.
create_embedding
,
methods
=
[
"POST"
],
response_model
=
CreateResponse
)
self
.
add_api_route
(
"/sdapi/v1/create/hypernetwork"
,
self
.
create_hypernetwork
,
methods
=
[
"POST"
],
response_model
=
CreateResponse
)
...
...
@@ -327,6 +328,13 @@ class Api:
def
get_artists
(
self
):
return
[{
"name"
:
x
[
0
],
"score"
:
x
[
1
],
"category"
:
x
[
2
]}
for
x
in
shared
.
artist_db
.
artists
]
def
get_embeddings
(
self
):
db
=
sd_hijack
.
model_hijack
.
embedding_db
return
{
"loaded"
:
sorted
(
db
.
word_embeddings
.
keys
()),
"skipped"
:
sorted
(
db
.
skipped_embeddings
),
}
def
refresh_checkpoints
(
self
):
shared
.
refresh_checkpoints
()
...
...
modules/api/models.py
浏览文件 @
b5819d9b
...
...
@@ -249,3 +249,6 @@ class ArtistItem(BaseModel):
score
:
float
=
Field
(
title
=
"Score"
)
category
:
str
=
Field
(
title
=
"Category"
)
class
EmbeddingsResponse
(
BaseModel
):
loaded
:
List
[
str
]
=
Field
(
title
=
"Loaded"
,
description
=
"Embeddings loaded for the current model"
)
skipped
:
List
[
str
]
=
Field
(
title
=
"Skipped"
,
description
=
"Embeddings skipped for the current model (likely due to architecture incompatibility)"
)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录