From 069caff88da65fe6a5d7bda483bab92efb53c885 Mon Sep 17 00:00:00 2001 From: Believethehype Date: Fri, 15 Dec 2023 10:29:56 +0100 Subject: [PATCH] simplify nip89 --- nostr_dvm/tasks/imagegeneration_sdxl.py | 22 +++++++------- .../tasks/imagegeneration_sdxlimg2img.py | 30 +++++++++---------- nostr_dvm/tasks/imageinterrogator.py | 21 +++++++------ nostr_dvm/tasks/imageupscale.py | 13 ++++---- nostr_dvm/tasks/textextraction_whisperx.py | 23 +++++++------- 5 files changed, 52 insertions(+), 57 deletions(-) diff --git a/nostr_dvm/tasks/imagegeneration_sdxl.py b/nostr_dvm/tasks/imagegeneration_sdxl.py index 7f6f131..b099861 100644 --- a/nostr_dvm/tasks/imagegeneration_sdxl.py +++ b/nostr_dvm/tasks/imagegeneration_sdxl.py @@ -176,23 +176,23 @@ def build_example(name, identifier, admin_config, server_address, default_model= # address it should use. These parameters can be freely defined in the task component options = {'default_model': default_model, 'default_lora': default_lora, 'server': server_address} - nip90params = { - "negative_prompt": { - "required": False, - "values": [] - }, - "ratio": { - "required": False, - "values": ["1:1", "4:3", "16:9", "3:4", "9:16", "10:16"] - } - } + nip89info = { "name": name, "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I draw images based on a prompt with a Model called unstable diffusion", "encryptionSupported": True, "cashuAccepted": True, - "nip90Params": nip90params + "nip90Params": { + "negative_prompt": { + "required": False, + "values": [] + }, + "ratio": { + "required": False, + "values": ["1:1", "4:3", "16:9", "3:4", "9:16", "10:16"] + } + } } nip89config = NIP89Config() nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, diff --git a/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py b/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py index c92161e..3291c5a 100644 --- a/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py +++ b/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py @@ -200,28 +200,26 @@ def build_example(name, identifier, admin_config, server_address, default_lora=" dvm_config = build_default_config(identifier) admin_config.LUD16 = dvm_config.LN_ADDRESS - nip90params = { - "negative_prompt": { - "required": False, - "values": [] - }, - "lora": { - "required": False, - "values": ["inkpunk", "timburton", "voxel"] - }, - - "strength": { - "required": False, - "values": [] - } - } nip89info = { "name": name, "image": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", "about": "I convert an image to another image, kinda random for now. ", "encryptionSupported": True, "cashuAccepted": True, - "nip90Params": nip90params + "nip90Params": { + "negative_prompt": { + "required": False, + "values": [] + }, + "lora": { + "required": False, + "values": ["inkpunk", "timburton", "voxel"] + }, + "strength": { + "required": False, + "values": [] + } + } } # A module might have options it can be initialized with, here we set a default model, lora and the server diff --git a/nostr_dvm/tasks/imageinterrogator.py b/nostr_dvm/tasks/imageinterrogator.py index bdb0033..9372e9c 100644 --- a/nostr_dvm/tasks/imageinterrogator.py +++ b/nostr_dvm/tasks/imageinterrogator.py @@ -115,23 +115,22 @@ def build_example(name, identifier, admin_config, server_address): dvm_config = build_default_config(identifier) admin_config.LUD16 = dvm_config.LN_ADDRESS - nip90params = { - "method": { - "required": False, - "values": ["prompt", "analysis"] - }, - "mode": { - "required": False, - "values": ["best", "classic", "fast", "negative"] - } - } nip89info = { "name": name, "image": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", "about": "I analyse Images an return a prompt or a prompt analysis", "encryptionSupported": True, "cashuAccepted": True, - "nip90Params": nip90params + "nip90Params": { + "method": { + "required": False, + "values": ["prompt", "analysis"] + }, + "mode": { + "required": False, + "values": ["best", "classic", "fast", "negative"] + } + } } # A module might have options it can be initialized with, here we set a default model, lora and the server diff --git a/nostr_dvm/tasks/imageupscale.py b/nostr_dvm/tasks/imageupscale.py index 10f6b3b..cbbdf42 100644 --- a/nostr_dvm/tasks/imageupscale.py +++ b/nostr_dvm/tasks/imageupscale.py @@ -113,19 +113,18 @@ def build_example(name, identifier, admin_config, server_address): dvm_config = build_default_config(identifier) admin_config.LUD16 = dvm_config.LN_ADDRESS - nip90params = { - "upscale": { - "required": False, - "values": ["2", "3", "4"] - } - } nip89info = { "name": name, "image": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", "about": "I upscale an image using realESRGan up to factor 4 (default is factor 4)", "encryptionSupported": True, "cashuAccepted": True, - "nip90Params": nip90params + "nip90Params": { + "upscale": { + "required": False, + "values": ["2", "3", "4"] + } + } } # A module might have options it can be initialized with, here we set a default model, lora and the server diff --git a/nostr_dvm/tasks/textextraction_whisperx.py b/nostr_dvm/tasks/textextraction_whisperx.py index 1aaa20c..49506b0 100644 --- a/nostr_dvm/tasks/textextraction_whisperx.py +++ b/nostr_dvm/tasks/textextraction_whisperx.py @@ -160,24 +160,23 @@ def build_example(name, identifier, admin_config, server_address): # address it should use. These parameters can be freely defined in the task component options = {'default_model': "base", 'server': server_address} - nip90params = { - "model": { - "required": False, - "values": ["base", "tiny", "small", "medium", "large-v1", "large-v2", "tiny.en", "base.en", "small.en", - "medium.en"] - }, - "alignment": { - "required": False, - "values": ["raw", "segment", "word"] - } - } nip89info = { "name": name, "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I extract text from media files with WhisperX", "encryptionSupported": True, "cashuAccepted": True, - "nip90Params": nip90params + "nip90Params": { + "model": { + "required": False, + "values": ["base", "tiny", "small", "medium", "large-v1", "large-v2", "tiny.en", "base.en", "small.en", + "medium.en"] + }, + "alignment": { + "required": False, + "values": ["raw", "segment", "word"] + } + } } nip89config = NIP89Config() nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY,