mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-06-05 17:09:17 +02:00
updates
This commit is contained in:
parent
27aa132ec9
commit
645fff6284
@ -13,9 +13,6 @@ A tutorial on how to add additional tasks, as well as the larger server backend
|
|||||||
|
|
||||||
Known Issues:
|
Known Issues:
|
||||||
- After refactoring DVMs work independent from each other for the most part.
|
- After refactoring DVMs work independent from each other for the most part.
|
||||||
- They currently still share a joblist and might act weird together (TODO rework joblist)
|
|
||||||
|
|
||||||
- Probably therefore jobs might sometimes not start (need investigation)
|
|
||||||
- Some functions might work easier than they did before (need some refactoring)
|
- Some functions might work easier than they did before (need some refactoring)
|
||||||
- Bot currently not implemented
|
- Bot currently not implemented
|
||||||
- Some basic functionality is still missing, e.g. handling various mediasources
|
- Some basic functionality is still missing, e.g. handling various mediasources
|
||||||
|
@ -11,8 +11,9 @@ from utils.output_utils import uploadMediaToHoster
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
This file contains basic calling functions for ML tasks that are outsourced to nova-server
|
This file contains basic calling functions for ML tasks that are outsourced to nova-server
|
||||||
(https://github.com/hcmlab/nova-server). nova-server is an Open-Source backend that enables running models locally, by
|
(https://github.com/hcmlab/nova-server). nova-server is an Open-Source backend that enables running models locally
|
||||||
accepting a request form. Modules are deployed in in separate virtual environments so dependencies won't conflict.
|
based on preefined modules (nova-server-modules), by accepting a request form.
|
||||||
|
Modules are deployed in in separate virtual environments so dependencies won't conflict.
|
||||||
|
|
||||||
Setup nova-server:
|
Setup nova-server:
|
||||||
https://hcmlab.github.io/nova-server/docbuild/html/tutorials/introduction.html
|
https://hcmlab.github.io/nova-server/docbuild/html/tutorials/introduction.html
|
||||||
@ -20,7 +21,7 @@ https://hcmlab.github.io/nova-server/docbuild/html/tutorials/introduction.html
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
send_request_to_nova_server(request_form)
|
send_request_to_nova_server(request_form, address)
|
||||||
Function to send a request_form to the server, containing all the information we parsed from the Nostr event and added
|
Function to send a request_form to the server, containing all the information we parsed from the Nostr event and added
|
||||||
in the module that is calling the server
|
in the module that is calling the server
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ def send_request_to_nova_server(request_form, address):
|
|||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
check_nova_server_status(request_form)
|
check_nova_server_status(request_form, address)
|
||||||
Function that requests the status of the current process with the jobID (we use the Nostr event as jobID).
|
Function that requests the status of the current process with the jobID (we use the Nostr event as jobID).
|
||||||
When the Job is successfully finished we grab the result and depending on the type return the output
|
When the Job is successfully finished we grab the result and depending on the type return the output
|
||||||
We throw an exception on error
|
We throw an exception on error
|
||||||
|
32
main.py
32
main.py
@ -30,10 +30,10 @@ def run_nostr_dvm_with_local_config():
|
|||||||
|
|
||||||
pdfextactor = TextExtractionPDF("PDF Extractor", dvm_config)
|
pdfextactor = TextExtractionPDF("PDF Extractor", dvm_config)
|
||||||
d_tag = os.getenv(env.TASK_TEXTEXTRACTION_NIP89_DTAG)
|
d_tag = os.getenv(env.TASK_TEXTEXTRACTION_NIP89_DTAG)
|
||||||
content = "{\"name\":\"" + pdfextactor.NAME + ("\",\"image\":\"https://image.nostr.build"
|
content = ("{\"name\":\"" + pdfextactor.NAME + "\","
|
||||||
"/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669"
|
"\"image\":\"https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg\","
|
||||||
".jpg\",\"about\":\"I extract Text from pdf documents\","
|
"\"about\":\"I extract Text from pdf documents\","
|
||||||
"\"nip90Params\":{}}")
|
"\"nip90Params\":{}}")
|
||||||
dvm_config.NIP89 = pdfextactor.NIP89_announcement(d_tag, content)
|
dvm_config.NIP89 = pdfextactor.NIP89_announcement(d_tag, content)
|
||||||
|
|
||||||
# Spawn DVM2 Kind 5002 Text Translation
|
# Spawn DVM2 Kind 5002 Text Translation
|
||||||
@ -44,11 +44,10 @@ def run_nostr_dvm_with_local_config():
|
|||||||
|
|
||||||
translator = Translation("Translator", dvm_config)
|
translator = Translation("Translator", dvm_config)
|
||||||
d_tag = os.getenv(env.TASK_TRANSLATION_NIP89_DTAG)
|
d_tag = os.getenv(env.TASK_TRANSLATION_NIP89_DTAG)
|
||||||
content = "{\"name\":\"" + translator.NAME + ("\",\"image\":\"https://image.nostr.build"
|
content = ("{\"name\":\"" + translator.NAME + "\","
|
||||||
"/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669"
|
"\"image\":\"https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg\","
|
||||||
".jpg\",\"about\":\"I translate text from given text/event/job, "
|
"\"about\":\"I translate text from given text/event/job, ""currently using Google Translation Services into language defined in params.\","
|
||||||
"currently using Google Translation Services into language defined "
|
"\"nip90Params\":{\"language\":{\"required\":true,"
|
||||||
"in param. \",\"nip90Params\":{\"language\":{\"required\":true,"
|
|
||||||
"\"values\":[\"af\",\"am\",\"ar\",\"az\",\"be\",\"bg\",\"bn\","
|
"\"values\":[\"af\",\"am\",\"ar\",\"az\",\"be\",\"bg\",\"bn\","
|
||||||
"\"bs\",\"ca\",\"ceb\",\"co\",\"cs\",\"cy\",\"da\",\"de\",\"el\","
|
"\"bs\",\"ca\",\"ceb\",\"co\",\"cs\",\"cy\",\"da\",\"de\",\"el\","
|
||||||
"\"eo\",\"es\",\"et\",\"eu\",\"fa\",\"fi\",\"fr\",\"fy\",\"ga\","
|
"\"eo\",\"es\",\"et\",\"eu\",\"fa\",\"fi\",\"fr\",\"fy\",\"ga\","
|
||||||
@ -72,9 +71,10 @@ def run_nostr_dvm_with_local_config():
|
|||||||
dvm_config.LNBITS_URL = os.getenv(env.LNBITS_HOST)
|
dvm_config.LNBITS_URL = os.getenv(env.LNBITS_HOST)
|
||||||
unstableartist = ImageGenerationSDXL("Unstable Diffusion", dvm_config, "unstable")
|
unstableartist = ImageGenerationSDXL("Unstable Diffusion", dvm_config, "unstable")
|
||||||
d_tag = os.getenv(env.TASK_IMAGEGENERATION_NIP89_DTAG)
|
d_tag = os.getenv(env.TASK_IMAGEGENERATION_NIP89_DTAG)
|
||||||
content = "{\"name\":\"" + unstableartist.NAME + ("\",\"image\":\"https://image.nostr.build"
|
content = ("{\"name\":\"" + unstableartist.NAME + "\","
|
||||||
"/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg"
|
"\"image\":\"https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg\","
|
||||||
"\",\"about\":\"I draw images based on a prompt with a Model called unstable diffusion.\",\"nip90Params\":{}}")
|
"\"about\":\"I draw images based on a prompt with a Model called unstable diffusion.\","
|
||||||
|
"\"nip90Params\":{}}")
|
||||||
dvm_config.NIP89 = unstableartist.NIP89_announcement(d_tag, content)
|
dvm_config.NIP89 = unstableartist.NIP89_announcement(d_tag, content)
|
||||||
|
|
||||||
|
|
||||||
@ -86,9 +86,11 @@ def run_nostr_dvm_with_local_config():
|
|||||||
#We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89
|
#We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89
|
||||||
sketcher = ImageGenerationSDXL("Sketcher", dvm_config, admin_config, default_model="mohawk", default_lora="timburton")
|
sketcher = ImageGenerationSDXL("Sketcher", dvm_config, admin_config, default_model="mohawk", default_lora="timburton")
|
||||||
d_tag = os.getenv(env.TASK_IMAGEGENERATION_NIP89_DTAG2)
|
d_tag = os.getenv(env.TASK_IMAGEGENERATION_NIP89_DTAG2)
|
||||||
content = "{\"name\":\"" + sketcher.NAME + ("\",\"image\":\"https://image.nostr.build"
|
content = ("{\"name\":\"" + unstableartist.NAME + "\","
|
||||||
"/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg"
|
"\"image\":\"https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg\","
|
||||||
"\",\"about\":\"I draw images based on a prompt in kind of Tim Burton style\",\"nip90Params\":{}}")
|
"\"about\":\"I draw images based on a prompt with a Model called unstable diffusion.\","
|
||||||
|
"\"nip90Params\":{}}")
|
||||||
|
|
||||||
dvm_config.NIP89 = sketcher.NIP89_announcement(d_tag, content)
|
dvm_config.NIP89 = sketcher.NIP89_announcement(d_tag, content)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user