Image Captioning, New API UI with UTM referral, Default 90s timeout + Dynamic timeout, Enhanced Prompt Weighting for txt2img and PhotoMaker, Changed Model Sorting
This commit is contained in:
@@ -5,30 +5,42 @@ class imageCaptioning:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"Always Recaption": ("BOOLEAN", {
|
||||
"default": False,
|
||||
"tooltip": "Enable this option to always recaption the image each time you run the workflow.",
|
||||
"label_on": "Enabled",
|
||||
"label_off": "Disabled",
|
||||
}),
|
||||
"Image": ("IMAGE", {
|
||||
"tooltip": "Specifies the input image to be processed."
|
||||
"tooltip": "Specify The Image to be Captioned."
|
||||
}),
|
||||
},
|
||||
"optional": {
|
||||
"Image Description": ("STRING", {
|
||||
"multiline": True,
|
||||
"placeholder": "Don't Write Anything Here, The Image Description Will Be Generated Automatically.",
|
||||
"placeholder": "You Don't Have to write Anything here.\nThe Image Description Will Be Generated Automatically.",
|
||||
}),
|
||||
},
|
||||
"hidden": { "node_id": "UNIQUE_ID" }
|
||||
}
|
||||
|
||||
DESCRIPTION = "Image to text, also known as image captioning, allows you to obtain descriptive text prompts based on uploaded or previously generated images. This process is instrumental in generating textual descriptions that can be used to create additional images or provide detailed insights into visual content."
|
||||
|
||||
FUNCTION = "imageCaptioning"
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("IMAGE PROMPT",)
|
||||
CATEGORY = "Runware"
|
||||
OUTPUT_NODE = True
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(s, **kwargs):
|
||||
alwaysRecaption = kwargs.get("Always Recaption")
|
||||
if(alwaysRecaption):
|
||||
return float("NAN")
|
||||
return True
|
||||
|
||||
def imageCaptioning(self, **kwargs):
|
||||
print(kwargs)
|
||||
image = kwargs.get("Image")
|
||||
kwargs.set("Image Description", "Don't Write Anything Here, The Image Description Will Be Generated Automatically.")
|
||||
genConfig = [
|
||||
{
|
||||
"taskType": "imageCaption",
|
||||
@@ -39,4 +51,5 @@ class imageCaptioning:
|
||||
|
||||
genResult = rwUtils.inferenecRequest(genConfig)
|
||||
genText = genResult["data"][0]["text"]
|
||||
rwUtils.sendImageCaption(genText, kwargs.get("node_id"))
|
||||
return (genText, )
|
||||
Reference in New Issue
Block a user