aboutsummaryrefslogtreecommitdiff
path: root/modules/api/models.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-11-06 11:28:00 +0300
committerGitHub <noreply@github.com>2022-11-06 11:28:00 +0300
commit5302e2cdd4c8f039a68e900d739285d15d99d200 (patch)
tree4fdad803a4536cec2bd3e622c5f4cfb980f04550 /modules/api/models.py
parent6e4de5b4422dfc0d45063b2c8c78b19f00321615 (diff)
parent07d1bd426722b4c53b38ff682c5aab53177d8530 (diff)
Merge pull request #3810 from royshil/roy.add_simple_interrogate_api
Add a barebones CLIP interrogate API endpoint
Diffstat (limited to 'modules/api/models.py')
-rw-r--r--modules/api/models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/api/models.py b/modules/api/models.py
index f89da1ff..34dbfa16 100644
--- a/modules/api/models.py
+++ b/modules/api/models.py
@@ -65,6 +65,7 @@ class PydanticModelGenerator:
self._model_name = model_name
self._class_data = merge_class_params(class_instance)
+
self._model_def = [
ModelDef(
field=underscore(k),
@@ -167,6 +168,12 @@ class ProgressResponse(BaseModel):
state: dict = Field(title="State", description="The current state snapshot")
current_image: str = Field(default=None, title="Current image", description="The current image in base64 format. opts.show_progress_every_n_steps is required for this to work.")
+class InterrogateRequest(BaseModel):
+ image: str = Field(default="", title="Image", description="Image to work on, must be a Base64 string containing the image's data.")
+
+class InterrogateResponse(BaseModel):
+ caption: str = Field(default=None, title="Caption", description="The generated caption for the image.")
+
fields = {}
for key, value in opts.data.items():
metadata = opts.data_labels.get(key)
@@ -231,3 +238,4 @@ class ArtistItem(BaseModel):
name: str = Field(title="Name")
score: float = Field(title="Score")
category: str = Field(title="Category")
+