mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-03-17 21:31:52 +01:00
reformating, fixes on windows, updating modules
This commit is contained in:
parent
75dc224a4d
commit
5722e1ac67
@ -6,12 +6,27 @@ Reusable backend functions can be defined in backends (e.g. API calls)
|
|||||||
|
|
||||||
Current List of Tasks:
|
Current List of Tasks:
|
||||||
|
|
||||||
| Module | Kind | Description | Backend |
|
| Module | Kind | Description | Backend |
|
||||||
|-------------------------|------|------------------------------------------------|-------------|
|
|------------------------------|--------------|------------------------------------------------------------|------------------|
|
||||||
| TextExtractionPDF | 5000 | Extracts Text from a PDF file | local |
|
| TextExtractionPDF | 5000 | Extracts Text from a PDF file | local |
|
||||||
| SpeechToTextGoogle | 5000 | Extracts Speech from Media files via Google | googleAPI |
|
| SpeechToTextGoogle | 5000 | Extracts Speech from Media files via Google Services | googleAPI |
|
||||||
| TranslationGoogle | 5002 | Translates Inputs to another language | googleAPI |
|
| SpeechToTextWhisperX | 5000 | Extracts Speech from Media files via local WhisperX | nserver |
|
||||||
| TranslationLibre | 5002 | Translates Inputs to another language | libreAPI |
|
| ImageInterrogator | 5000 | Extracts Prompts from Images | nserver |
|
||||||
| ImageGenerationDALLE | 5100 | Generates an Image with Dall-E | openAI |
|
| TranslationGoogle | 5002 | Translates Inputs to another language | googleAPI |
|
||||||
| MediaConverter | 5200 | Converts a link of a media file and uploads it | openAI |
|
| TranslationLibre | 5002 | Translates Inputs to another language | libreAPI |
|
||||||
| DiscoverInactiveFollows | 5301 | Find inactive Nostr users | local |
|
| TextGenerationLLMLite | 5050 | Chat with LLM backends like Ollama, ChatGPT etc | local/api/openai |
|
||||||
|
| ImageGenerationSDXL | 5100 | Generates an Image from Prompt with Stable Diffusion XL | nserver |
|
||||||
|
| ImageGenerationSDXLIMG2IMG | 5100 | Generates an Image from an Image with Stable Diffusion XL | nserver |
|
||||||
|
| ImageGenerationReplicateSDXL | 5100 | Generates an Image from Prompt with Stable Diffusion XL | replicate |
|
||||||
|
| ImageGenerationMLX | 5100 | Generates an Image with Stable Diffusion 2.1 on M1/2/3 Mac | mlx |
|
||||||
|
| ImageGenerationDALLE | 5100 | Generates an Image with OpenAI's Dall-E | openAI |
|
||||||
|
| ImageUpscale | 5100 | Upscales an Image | nserver |
|
||||||
|
| MediaConverter | 5200 | Converts a link of a media file and uploads it | openAI |
|
||||||
|
| VideoGenerationReplicateSVD | 5202 (inoff) | Generates a Video from an Image | replicate |
|
||||||
|
| TextToSpeech | 5250 (inoff) | Generate Audio from a prompt | local |
|
||||||
|
| TrendingNotesNostrBand | 5300 | Show trending notes on nostr.band | nostr.band api |
|
||||||
|
| DiscoverInactiveFollows | 5301 | Find inactive Nostr users | local |
|
||||||
|
| AdvancedSearch | 5302 (inoff) | Search Content on nostr.band | local |
|
||||||
|
|
||||||
|
Kinds with (inoff) are suggestions and not merged yet and might change in the future.
|
||||||
|
Backends might require to add an API key to the .env file or run an external server/framework the dvm will communicate with.
|
@ -47,8 +47,8 @@ class AdvancedSearch(DVMTaskInterface):
|
|||||||
|
|
||||||
# default values
|
# default values
|
||||||
user = ""
|
user = ""
|
||||||
since_days = 800 #days ago
|
since_days = 800 # days ago
|
||||||
until_days = 0 #days ago
|
until_days = 0 # days ago
|
||||||
search = ""
|
search = ""
|
||||||
max_results = 20
|
max_results = 20
|
||||||
|
|
||||||
@ -98,11 +98,14 @@ class AdvancedSearch(DVMTaskInterface):
|
|||||||
search_until = Timestamp.from_secs(dif)
|
search_until = Timestamp.from_secs(dif)
|
||||||
|
|
||||||
if options["user"] == "":
|
if options["user"] == "":
|
||||||
notes_filter = Filter().kind(1).search(options["search"]).since(search_since).until(search_until).limit(options["max_results"])
|
notes_filter = Filter().kind(1).search(options["search"]).since(search_since).until(search_until).limit(
|
||||||
|
options["max_results"])
|
||||||
elif options["search"] == "":
|
elif options["search"] == "":
|
||||||
notes_filter = Filter().kind(1).author(PublicKey.from_hex(options["user"])).since(search_since).until(search_until).limit(options["max_results"])
|
notes_filter = Filter().kind(1).author(PublicKey.from_hex(options["user"])).since(search_since).until(
|
||||||
|
search_until).limit(options["max_results"])
|
||||||
else:
|
else:
|
||||||
notes_filter = Filter().kind(1).author(PublicKey.from_hex(options["user"])).search(options["search"]).since(search_since).until(search_until).limit(options["max_results"])
|
notes_filter = Filter().kind(1).author(PublicKey.from_hex(options["user"])).search(options["search"]).since(
|
||||||
|
search_since).until(search_until).limit(options["max_results"])
|
||||||
|
|
||||||
events = cli.get_events_of([notes_filter], timedelta(seconds=5))
|
events = cli.get_events_of([notes_filter], timedelta(seconds=5))
|
||||||
|
|
||||||
@ -116,8 +119,6 @@ class AdvancedSearch(DVMTaskInterface):
|
|||||||
|
|
||||||
return json.dumps(result_list)
|
return json.dumps(result_list)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def post_process(self, result, event):
|
def post_process(self, result, event):
|
||||||
"""Overwrite the interface function to return a social client readable format, if requested"""
|
"""Overwrite the interface function to return a social client readable format, if requested"""
|
||||||
for tag in event.tags():
|
for tag in event.tags():
|
||||||
@ -170,9 +171,9 @@ def build_example(name, identifier, admin_config):
|
|||||||
nip89config = NIP89Config()
|
nip89config = NIP89Config()
|
||||||
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"])
|
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"])
|
||||||
nip89config.CONTENT = json.dumps(nip89info)
|
nip89config.CONTENT = json.dumps(nip89info)
|
||||||
|
|
||||||
return AdvancedSearch(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
return AdvancedSearch(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||||
admin_config=admin_config)
|
admin_config=admin_config)
|
||||||
|
|
||||||
|
|
||||||
def process_venv():
|
def process_venv():
|
||||||
@ -182,5 +183,6 @@ def process_venv():
|
|||||||
result = dvm.process(json.loads(args.request))
|
result = dvm.process(json.loads(args.request))
|
||||||
DVMTaskInterface.write_output(result, args.output)
|
DVMTaskInterface.write_output(result, args.output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -8,7 +8,6 @@ from nostr_dvm.utils.nip89_utils import NIP89Config
|
|||||||
from nostr_dvm.utils.mediasource_utils import organize_input_media_data
|
from nostr_dvm.utils.mediasource_utils import organize_input_media_data
|
||||||
from nostr_dvm.utils.output_utils import upload_media_to_hoster
|
from nostr_dvm.utils.output_utils import upload_media_to_hoster
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This File contains a Module convert media locally
|
This File contains a Module convert media locally
|
||||||
|
|
||||||
@ -98,10 +97,10 @@ def build_example(name, identifier, admin_config):
|
|||||||
|
|
||||||
nip89config = NIP89Config()
|
nip89config = NIP89Config()
|
||||||
|
|
||||||
|
|
||||||
return MediaConverter(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
return MediaConverter(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||||
admin_config=admin_config)
|
admin_config=admin_config)
|
||||||
|
|
||||||
|
|
||||||
def process_venv():
|
def process_venv():
|
||||||
args = DVMTaskInterface.process_args()
|
args = DVMTaskInterface.process_args()
|
||||||
dvm_config = build_default_config(args.identifier)
|
dvm_config = build_default_config(args.identifier)
|
||||||
@ -111,4 +110,4 @@ def process_venv():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -163,6 +163,7 @@ class DiscoverInactiveFollows(DVMTaskInterface):
|
|||||||
# if not text/plain, don't post-process
|
# if not text/plain, don't post-process
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
@ -196,6 +197,7 @@ def build_example(name, identifier, admin_config):
|
|||||||
return DiscoverInactiveFollows(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
return DiscoverInactiveFollows(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||||
admin_config=admin_config)
|
admin_config=admin_config)
|
||||||
|
|
||||||
|
|
||||||
def process_venv():
|
def process_venv():
|
||||||
args = DVMTaskInterface.process_args()
|
args = DVMTaskInterface.process_args()
|
||||||
dvm_config = build_default_config(args.identifier)
|
dvm_config = build_default_config(args.identifier)
|
||||||
@ -203,5 +205,6 @@ def process_venv():
|
|||||||
result = dvm.process(json.loads(args.request))
|
result = dvm.process(json.loads(args.request))
|
||||||
DVMTaskInterface.write_output(result, args.output)
|
DVMTaskInterface.write_output(result, args.output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -107,7 +107,6 @@ class ImageGenerationDALLE(DVMTaskInterface):
|
|||||||
n=int(options['number']),
|
n=int(options['number']),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
image_url = response.data[0].url
|
image_url = response.data[0].url
|
||||||
# rehost the result instead of relying on the openai link
|
# rehost the result instead of relying on the openai link
|
||||||
response = requests.get(image_url)
|
response = requests.get(image_url)
|
||||||
@ -162,8 +161,8 @@ def process_venv():
|
|||||||
result = dvm.process(json.loads(args.request))
|
result = dvm.process(json.loads(args.request))
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
|
|
||||||
DVMTaskInterface.write_output(result, args.output)
|
DVMTaskInterface.write_output(result, args.output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -6,7 +6,6 @@ from PIL import Image
|
|||||||
|
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
@ -153,5 +152,6 @@ def process_venv():
|
|||||||
result = dvm.process(json.loads(args.request))
|
result = dvm.process(json.loads(args.request))
|
||||||
DVMTaskInterface.write_output(result, args.output)
|
DVMTaskInterface.write_output(result, args.output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -1,21 +1,12 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
|
|
||||||
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server
|
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
|
||||||
from nostr_sdk import Keys
|
|
||||||
|
|
||||||
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This File contains a module to transform Text input on n-server and receive results back.
|
This File contains a module to transform Text input on n-server and receive results back.
|
||||||
@ -165,11 +156,12 @@ class ImageGenerationSDXL(DVMTaskInterface):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(e)
|
raise Exception(e)
|
||||||
|
|
||||||
|
|
||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
def build_example(name, identifier, admin_config, server_address, default_model="stabilityai/stable-diffusion-xl"
|
def build_example(name, identifier, admin_config, server_address, default_model="stabilityai/stable-diffusion-xl"
|
||||||
"-base-1.0", default_lora=""):
|
"-base-1.0", default_lora=""):
|
||||||
dvm_config = build_default_config(identifier)
|
dvm_config = build_default_config(identifier)
|
||||||
dvm_config.USE_OWN_VENV = False
|
dvm_config.USE_OWN_VENV = False
|
||||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||||
@ -177,7 +169,6 @@ 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
|
# 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}
|
options = {'default_model': default_model, 'default_lora': default_lora, 'server': server_address}
|
||||||
|
|
||||||
|
|
||||||
nip89info = {
|
nip89info = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg",
|
"image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg",
|
||||||
|
@ -1,23 +1,15 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
|
|
||||||
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server
|
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
|
||||||
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
|
|
||||||
from nostr_sdk import Keys
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This File contains a Module to transform Text input on N-server and receive results back.
|
This File contains a Module to transform Image (and Text) input on N-server and receive results back.
|
||||||
|
|
||||||
Accepted Inputs: Prompt (text)
|
Accepted Inputs: Prompt (text)
|
||||||
Outputs: An url to an Image
|
Outputs: An url to an Image
|
||||||
@ -45,7 +37,7 @@ class ImageGenerationSDXLIMG2IMG(DVMTaskInterface):
|
|||||||
if input_type == "url":
|
if input_type == "url":
|
||||||
hasurl = True
|
hasurl = True
|
||||||
elif input_type == "text":
|
elif input_type == "text":
|
||||||
hasprompt = True #Little optional when lora is set
|
hasprompt = True # Little optional when lora is set
|
||||||
|
|
||||||
elif tag.as_vec()[0] == 'output':
|
elif tag.as_vec()[0] == 'output':
|
||||||
output = tag.as_vec()[1]
|
output = tag.as_vec()[1]
|
||||||
@ -132,15 +124,11 @@ class ImageGenerationSDXLIMG2IMG(DVMTaskInterface):
|
|||||||
elif tag.as_vec()[1] == "model":
|
elif tag.as_vec()[1] == "model":
|
||||||
model = tag.as_vec()[2]
|
model = tag.as_vec()[2]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
io_input_image = {
|
io_input_image = {
|
||||||
"id": "input_image",
|
"id": "input_image",
|
||||||
"type": "input",
|
"type": "input",
|
||||||
"src": "url:Image",
|
"src": "url:Image",
|
||||||
"uri": url
|
"uri": url
|
||||||
}
|
}
|
||||||
io_input = {
|
io_input = {
|
||||||
"id": "input_prompt",
|
"id": "input_prompt",
|
||||||
@ -193,6 +181,7 @@ class ImageGenerationSDXLIMG2IMG(DVMTaskInterface):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(e)
|
raise Exception(e)
|
||||||
|
|
||||||
|
|
||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
|
@ -1,20 +1,12 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
|
|
||||||
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server
|
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
|
||||||
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
|
|
||||||
from nostr_sdk import Keys
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This File contains a Module to extract a prompt from an image from an url.
|
This File contains a Module to extract a prompt from an image from an url.
|
||||||
@ -55,7 +47,6 @@ class ImageInterrogator(DVMTaskInterface):
|
|||||||
method = "prompt"
|
method = "prompt"
|
||||||
mode = "best"
|
mode = "best"
|
||||||
|
|
||||||
|
|
||||||
for tag in event.tags():
|
for tag in event.tags():
|
||||||
if tag.as_vec()[0] == 'i':
|
if tag.as_vec()[0] == 'i':
|
||||||
input_type = tag.as_vec()[2]
|
input_type = tag.as_vec()[2]
|
||||||
@ -69,10 +60,10 @@ class ImageInterrogator(DVMTaskInterface):
|
|||||||
mode = tag.as_vec()[2]
|
mode = tag.as_vec()[2]
|
||||||
|
|
||||||
io_input_image = {
|
io_input_image = {
|
||||||
"id": "input_image",
|
"id": "input_image",
|
||||||
"type": "input",
|
"type": "input",
|
||||||
"src": "url:Image",
|
"src": "url:Image",
|
||||||
"uri": url
|
"uri": url
|
||||||
}
|
}
|
||||||
|
|
||||||
io_output = {
|
io_output = {
|
||||||
@ -108,6 +99,7 @@ class ImageInterrogator(DVMTaskInterface):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(e)
|
raise Exception(e)
|
||||||
|
|
||||||
|
|
||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
@ -142,7 +134,7 @@ def build_example(name, identifier, admin_config, server_address):
|
|||||||
nip89config.CONTENT = json.dumps(nip89info)
|
nip89config.CONTENT = json.dumps(nip89info)
|
||||||
|
|
||||||
return ImageInterrogator(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
return ImageInterrogator(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||||
admin_config=admin_config, options=options)
|
admin_config=admin_config, options=options)
|
||||||
|
|
||||||
|
|
||||||
def process_venv():
|
def process_venv():
|
||||||
|
@ -1,20 +1,12 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
|
|
||||||
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server
|
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
|
||||||
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
|
|
||||||
from nostr_sdk import Keys
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This File contains a Module to upscale an image from an url by factor 2-4
|
This File contains a Module to upscale an image from an url by factor 2-4
|
||||||
|
@ -1,20 +1,16 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
|
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.mediasource_utils import organize_input_media_data
|
from nostr_dvm.utils.mediasource_utils import organize_input_media_data
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This File contains a Module to transform a media file input on Google Cloud
|
This File contains a Module to extract text form a media file input on Google Cloud
|
||||||
|
|
||||||
Accepted Inputs: Url to media file (url)
|
Accepted Inputs: Url to media file (url)
|
||||||
Outputs: Transcribed text
|
Outputs: Transcribed text
|
||||||
@ -30,7 +26,6 @@ class SpeechToTextGoogle(DVMTaskInterface):
|
|||||||
dependencies = [("nostr-dvm", "nostr-dvm"),
|
dependencies = [("nostr-dvm", "nostr-dvm"),
|
||||||
("speech_recognition", "SpeechRecognition==3.10.0")]
|
("speech_recognition", "SpeechRecognition==3.10.0")]
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, name, dvm_config: DVMConfig, nip89config: NIP89Config,
|
def __init__(self, name, dvm_config: DVMConfig, nip89config: NIP89Config,
|
||||||
admin_config: AdminConfig = None, options=None):
|
admin_config: AdminConfig = None, options=None):
|
||||||
dvm_config.SCRIPT = os.path.abspath(__file__)
|
dvm_config.SCRIPT = os.path.abspath(__file__)
|
||||||
@ -129,6 +124,7 @@ class SpeechToTextGoogle(DVMTaskInterface):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
@ -158,6 +154,8 @@ def build_example(name, identifier, admin_config):
|
|||||||
|
|
||||||
return SpeechToTextGoogle(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
return SpeechToTextGoogle(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||||
admin_config=admin_config, options=options)
|
admin_config=admin_config, options=options)
|
||||||
|
|
||||||
|
|
||||||
def process_venv():
|
def process_venv():
|
||||||
args = DVMTaskInterface.process_args()
|
args = DVMTaskInterface.process_args()
|
||||||
dvm_config = build_default_config(args.identifier)
|
dvm_config = build_default_config(args.identifier)
|
||||||
@ -167,4 +165,4 @@ def process_venv():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
|
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
@ -29,14 +25,11 @@ class TextExtractionPDF(DVMTaskInterface):
|
|||||||
dependencies = [("nostr-dvm", "nostr-dvm"),
|
dependencies = [("nostr-dvm", "nostr-dvm"),
|
||||||
("pypdf", "pypdf==3.17.1")]
|
("pypdf", "pypdf==3.17.1")]
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, name, dvm_config: DVMConfig, nip89config: NIP89Config,
|
def __init__(self, name, dvm_config: DVMConfig, nip89config: NIP89Config,
|
||||||
admin_config: AdminConfig = None, options=None):
|
admin_config: AdminConfig = None, options=None):
|
||||||
dvm_config.SCRIPT = os.path.abspath(__file__)
|
dvm_config.SCRIPT = os.path.abspath(__file__)
|
||||||
super().__init__(name, dvm_config, nip89config, admin_config, options)
|
super().__init__(name, dvm_config, nip89config, admin_config, options)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def is_input_supported(self, tags):
|
def is_input_supported(self, tags):
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
if tag.as_vec()[0] == 'i':
|
if tag.as_vec()[0] == 'i':
|
||||||
@ -118,6 +111,7 @@ def build_example(name, identifier, admin_config):
|
|||||||
return TextExtractionPDF(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
return TextExtractionPDF(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||||
admin_config=admin_config)
|
admin_config=admin_config)
|
||||||
|
|
||||||
|
|
||||||
def process_venv():
|
def process_venv():
|
||||||
args = DVMTaskInterface.process_args()
|
args = DVMTaskInterface.process_args()
|
||||||
dvm_config = build_default_config(args.identifier)
|
dvm_config = build_default_config(args.identifier)
|
||||||
@ -127,4 +121,4 @@ def process_venv():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -2,21 +2,13 @@ import json
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
|
|
||||||
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server, send_file_to_server
|
from nostr_dvm.backends.nova_server.utils import check_server_status, send_request_to_server, send_file_to_server
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.mediasource_utils import organize_input_media_data
|
from nostr_dvm.utils.mediasource_utils import organize_input_media_data
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
|
||||||
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
|
|
||||||
from nostr_sdk import Keys
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This File contains a Module to transform A media file input on n-server and receive results back.
|
This File contains a Module to transform A media file input on n-server and receive results back.
|
||||||
@ -108,7 +100,8 @@ class SpeechToTextWhisperX(DVMTaskInterface):
|
|||||||
except:
|
except:
|
||||||
end_time = float(tag.as_vec()[3])
|
end_time = float(tag.as_vec()[3])
|
||||||
|
|
||||||
filepath = organize_input_media_data(url, input_type, start_time, end_time, dvm_config, client, True, media_format)
|
filepath = organize_input_media_data(url, input_type, start_time, end_time, dvm_config, client, True,
|
||||||
|
media_format)
|
||||||
path_on_server = send_file_to_server(os.path.realpath(filepath), self.options['server'])
|
path_on_server = send_file_to_server(os.path.realpath(filepath), self.options['server'])
|
||||||
|
|
||||||
io_input = {
|
io_input = {
|
||||||
@ -149,6 +142,7 @@ class SpeechToTextWhisperX(DVMTaskInterface):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(e)
|
raise Exception(e)
|
||||||
|
|
||||||
|
|
||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
@ -182,7 +176,7 @@ def build_example(name, identifier, admin_config, server_address):
|
|||||||
nip89config = NIP89Config()
|
nip89config = NIP89Config()
|
||||||
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"])
|
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"])
|
||||||
nip89config.CONTENT = json.dumps(nip89info)
|
nip89config.CONTENT = json.dumps(nip89info)
|
||||||
|
|
||||||
return SpeechToTextWhisperX(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
return SpeechToTextWhisperX(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||||
admin_config=admin_config, options=options)
|
admin_config=admin_config, options=options)
|
||||||
|
|
||||||
@ -194,5 +188,6 @@ def process_venv():
|
|||||||
result = dvm.process(json.loads(args.request))
|
result = dvm.process(json.loads(args.request))
|
||||||
DVMTaskInterface.write_output(result, args.output)
|
DVMTaskInterface.write_output(result, args.output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
|
|
||||||
|
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
|
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import urllib.request
|
import urllib.request
|
||||||
@ -79,7 +80,7 @@ class TextToSpeech(DVMTaskInterface):
|
|||||||
from TTS.api import TTS
|
from TTS.api import TTS
|
||||||
options = DVMTaskInterface.set_options(request_form)
|
options = DVMTaskInterface.set_options(request_form)
|
||||||
device = "cuda" if torch.cuda.is_available() else "cpu"
|
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||||
#else "mps" if torch.backends.mps.is_available() \
|
# else "mps" if torch.backends.mps.is_available() \
|
||||||
|
|
||||||
print(TTS().list_models())
|
print(TTS().list_models())
|
||||||
try:
|
try:
|
||||||
@ -102,7 +103,7 @@ def build_example(name, identifier, admin_config):
|
|||||||
dvm_config = build_default_config(identifier)
|
dvm_config = build_default_config(identifier)
|
||||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||||
|
|
||||||
#use an alternative local wav file you want to use for cloning
|
# use an alternative local wav file you want to use for cloning
|
||||||
options = {'input_file': ""}
|
options = {'input_file': ""}
|
||||||
|
|
||||||
nip89info = {
|
nip89info = {
|
||||||
@ -134,5 +135,6 @@ def process_venv():
|
|||||||
result = dvm.process(json.loads(args.request))
|
result = dvm.process(json.loads(args.request))
|
||||||
DVMTaskInterface.write_output(result, args.output)
|
DVMTaskInterface.write_output(result, args.output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -1,20 +1,14 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
|
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
from nostr_dvm.utils.nostr_utils import get_referenced_event_by_id, get_event_by_id
|
from nostr_dvm.utils.nostr_utils import get_referenced_event_by_id, get_event_by_id
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This File contains a Module to call Google Translate Services locally on the DVM Machine
|
This File contains a Module to call Google Translate Services on the DVM Machine
|
||||||
|
|
||||||
Accepted Inputs: Text, Events, Jobs (Text Extraction, Summary, Translation)
|
Accepted Inputs: Text, Events, Jobs (Text Extraction, Summary, Translation)
|
||||||
Outputs: Text containing the TranslationGoogle in the desired language.
|
Outputs: Text containing the TranslationGoogle in the desired language.
|
||||||
@ -111,6 +105,7 @@ class TranslationGoogle(DVMTaskInterface):
|
|||||||
|
|
||||||
return translated_text
|
return translated_text
|
||||||
|
|
||||||
|
|
||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
@ -128,12 +123,18 @@ def build_example(name, identifier, admin_config):
|
|||||||
"nip90Params": {
|
"nip90Params": {
|
||||||
"language": {
|
"language": {
|
||||||
"required": False,
|
"required": False,
|
||||||
"values": ["en", "az", "be", "bg", "bn", "bs", "ca", "ceb", "co", "cs", "cy", "da", "de", "el", "eo", "es",
|
"values": ["en", "az", "be", "bg", "bn", "bs", "ca", "ceb", "co", "cs", "cy", "da", "de", "el", "eo",
|
||||||
"et", "eu", "fa", "fi", "fr", "fy", "ga", "gd", "gl", "gu", "ha", "haw", "hi", "hmn", "hr", "ht",
|
"es",
|
||||||
"hu", "hy", "id", "ig", "is", "it", "he", "ja", "jv", "ka", "kk", "km", "kn", "ko", "ku", "ky",
|
"et", "eu", "fa", "fi", "fr", "fy", "ga", "gd", "gl", "gu", "ha", "haw", "hi", "hmn", "hr",
|
||||||
"la", "lb", "lo", "lt", "lv", "mg", "mi", "mk", "ml", "mn", "mr", "ms", "mt", "my", "ne", "nl",
|
"ht",
|
||||||
"no", "ny", "or", "pa", "pl", "ps", "pt", "ro", "ru", "sd", "si", "sk", "sl", "sm", "sn", "so",
|
"hu", "hy", "id", "ig", "is", "it", "he", "ja", "jv", "ka", "kk", "km", "kn", "ko", "ku",
|
||||||
"sq", "sr", "st", "su", "sv", "sw", "ta", "te", "tg", "th", "tl", "tr", "ug", "uk", "ur", "uz",
|
"ky",
|
||||||
|
"la", "lb", "lo", "lt", "lv", "mg", "mi", "mk", "ml", "mn", "mr", "ms", "mt", "my", "ne",
|
||||||
|
"nl",
|
||||||
|
"no", "ny", "or", "pa", "pl", "ps", "pt", "ro", "ru", "sd", "si", "sk", "sl", "sm", "sn",
|
||||||
|
"so",
|
||||||
|
"sq", "sr", "st", "su", "sv", "sw", "ta", "te", "tg", "th", "tl", "tr", "ug", "uk", "ur",
|
||||||
|
"uz",
|
||||||
"vi", "xh", "yi", "yo", "zh", "zu"]
|
"vi", "xh", "yi", "yo", "zh", "zu"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,7 +146,6 @@ def build_example(name, identifier, admin_config):
|
|||||||
return TranslationGoogle(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config)
|
return TranslationGoogle(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def process_venv():
|
def process_venv():
|
||||||
args = DVMTaskInterface.process_args()
|
args = DVMTaskInterface.process_args()
|
||||||
dvm_config = build_default_config(args.identifier)
|
dvm_config = build_default_config(args.identifier)
|
||||||
@ -155,4 +155,4 @@ def process_venv():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
@ -156,5 +152,6 @@ def process_venv():
|
|||||||
result = dvm.process(json.loads(args.request))
|
result = dvm.process(json.loads(args.request))
|
||||||
DVMTaskInterface.write_output(result, args.output)
|
DVMTaskInterface.write_output(result, args.output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
from nostr_sdk import Tag
|
from nostr_sdk import Tag
|
||||||
|
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
@ -118,6 +114,7 @@ def build_example(name, identifier, admin_config):
|
|||||||
return TrendingNotesNostrBand(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
return TrendingNotesNostrBand(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||||
admin_config=admin_config)
|
admin_config=admin_config)
|
||||||
|
|
||||||
|
|
||||||
def process_venv():
|
def process_venv():
|
||||||
args = DVMTaskInterface.process_args()
|
args = DVMTaskInterface.process_args()
|
||||||
dvm_config = build_default_config(args.identifier)
|
dvm_config = build_default_config(args.identifier)
|
||||||
@ -125,5 +122,6 @@ def process_venv():
|
|||||||
result = dvm.process(json.loads(args.request))
|
result = dvm.process(json.loads(args.request))
|
||||||
DVMTaskInterface.write_output(result, args.output)
|
DVMTaskInterface.write_output(result, args.output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
|
||||||
import requests
|
import requests
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.backend_utils import keep_alive
|
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||||
@ -39,9 +34,6 @@ class VideoGenerationReplicateSVD(DVMTaskInterface):
|
|||||||
dvm_config.SCRIPT = os.path.abspath(__file__)
|
dvm_config.SCRIPT = os.path.abspath(__file__)
|
||||||
super().__init__(name, dvm_config, nip89config, admin_config, options)
|
super().__init__(name, dvm_config, nip89config, admin_config, options)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def is_input_supported(self, tags):
|
def is_input_supported(self, tags):
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
if tag.as_vec()[0] == 'i':
|
if tag.as_vec()[0] == 'i':
|
||||||
@ -140,6 +132,7 @@ def build_example(name, identifier, admin_config):
|
|||||||
return VideoGenerationReplicateSVD(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
return VideoGenerationReplicateSVD(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||||
admin_config=admin_config)
|
admin_config=admin_config)
|
||||||
|
|
||||||
|
|
||||||
def process_venv():
|
def process_venv():
|
||||||
args = DVMTaskInterface.process_args()
|
args = DVMTaskInterface.process_args()
|
||||||
dvm_config = build_default_config(args.identifier)
|
dvm_config = build_default_config(args.identifier)
|
||||||
@ -149,4 +142,4 @@ def process_venv():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_venv()
|
process_venv()
|
||||||
|
@ -2,6 +2,8 @@ import os
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from nostr_sdk import Event
|
from nostr_sdk import Event
|
||||||
|
|
||||||
|
|
||||||
class EventDefinitions:
|
class EventDefinitions:
|
||||||
KIND_DM = 4
|
KIND_DM = 4
|
||||||
KIND_ZAP = 9735
|
KIND_ZAP = 9735
|
||||||
@ -14,8 +16,6 @@ class EventDefinitions:
|
|||||||
KIND_NIP90_RESULT_SUMMARIZE_TEXT = KIND_NIP90_SUMMARIZE_TEXT + 1000
|
KIND_NIP90_RESULT_SUMMARIZE_TEXT = KIND_NIP90_SUMMARIZE_TEXT + 1000
|
||||||
KIND_NIP90_TRANSLATE_TEXT = 5002
|
KIND_NIP90_TRANSLATE_TEXT = 5002
|
||||||
KIND_NIP90_RESULT_TRANSLATE_TEXT = KIND_NIP90_TRANSLATE_TEXT + 1000
|
KIND_NIP90_RESULT_TRANSLATE_TEXT = KIND_NIP90_TRANSLATE_TEXT + 1000
|
||||||
KIND_NIP90_TEXT_TO_SPEECH = 5005
|
|
||||||
KIND_NIP90_RESULT_TEXT_TO_SPEECH = KIND_NIP90_TEXT_TO_SPEECH + 1000
|
|
||||||
KIND_NIP90_GENERATE_TEXT = 5050
|
KIND_NIP90_GENERATE_TEXT = 5050
|
||||||
KIND_NIP90_RESULT_GENERATE_TEXT = KIND_NIP90_GENERATE_TEXT + 1000
|
KIND_NIP90_RESULT_GENERATE_TEXT = KIND_NIP90_GENERATE_TEXT + 1000
|
||||||
KIND_NIP90_GENERATE_IMAGE = 5100
|
KIND_NIP90_GENERATE_IMAGE = 5100
|
||||||
@ -23,6 +23,8 @@ class EventDefinitions:
|
|||||||
KIND_NIP90_CONVERT_VIDEO = 5200
|
KIND_NIP90_CONVERT_VIDEO = 5200
|
||||||
KIND_NIP90_RESULT_CONVERT_VIDEO = KIND_NIP90_CONVERT_VIDEO + 1000
|
KIND_NIP90_RESULT_CONVERT_VIDEO = KIND_NIP90_CONVERT_VIDEO + 1000
|
||||||
KIND_NIP90_GENERATE_VIDEO = 5202
|
KIND_NIP90_GENERATE_VIDEO = 5202
|
||||||
|
KIND_NIP90_TEXT_TO_SPEECH = 5250
|
||||||
|
KIND_NIP90_RESULT_TEXT_TO_SPEECH = KIND_NIP90_TEXT_TO_SPEECH + 1000
|
||||||
KIND_NIP90_RESULT_GENERATE_VIDEO = KIND_NIP90_GENERATE_VIDEO + 1000
|
KIND_NIP90_RESULT_GENERATE_VIDEO = KIND_NIP90_GENERATE_VIDEO + 1000
|
||||||
KIND_NIP90_CONTENT_DISCOVERY = 5300
|
KIND_NIP90_CONTENT_DISCOVERY = 5300
|
||||||
KIND_NIP90_RESULT_CONTENT_DISCOVERY = KIND_NIP90_CONTENT_DISCOVERY + 1000
|
KIND_NIP90_RESULT_CONTENT_DISCOVERY = KIND_NIP90_CONTENT_DISCOVERY + 1000
|
||||||
@ -59,6 +61,7 @@ class JobToWatch:
|
|||||||
payment_hash: str
|
payment_hash: str
|
||||||
expires: int
|
expires: int
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class RequiredJobToWatch:
|
class RequiredJobToWatch:
|
||||||
event: Event
|
event: Event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user