mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-06-03 14:49:11 +02:00
added huggingchat examples
This commit is contained in:
parent
b65b62d6b9
commit
7dc5bc8821
14
main.py
14
main.py
@ -7,7 +7,7 @@ from nostr_dvm.bot import Bot
|
|||||||
from nostr_dvm.tasks import videogeneration_replicate_svd, imagegeneration_replicate_sdxl, textgeneration_llmlite, \
|
from nostr_dvm.tasks import videogeneration_replicate_svd, imagegeneration_replicate_sdxl, textgeneration_llmlite, \
|
||||||
trending_notes_nostrband, discovery_inactive_follows, translation_google, textextraction_pdf, \
|
trending_notes_nostrband, discovery_inactive_follows, translation_google, textextraction_pdf, \
|
||||||
translation_libretranslate, textextraction_google, convert_media, imagegeneration_openai_dalle, texttospeech, \
|
translation_libretranslate, textextraction_google, convert_media, imagegeneration_openai_dalle, texttospeech, \
|
||||||
imagegeneration_sd21_mlx, advanced_search, textgeneration_huggingchat
|
imagegeneration_sd21_mlx, advanced_search, textgeneration_huggingchat, summarization_huggingchat
|
||||||
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.backend_utils import keep_alive
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions
|
from nostr_dvm.utils.definitions import EventDefinitions
|
||||||
@ -155,10 +155,16 @@ def playground():
|
|||||||
bot_config.SUPPORTED_DVMS.append(mlx)
|
bot_config.SUPPORTED_DVMS.append(mlx)
|
||||||
mlx.run()
|
mlx.run()
|
||||||
|
|
||||||
|
if os.getenv("HUGGINGFACE_EMAIL") is not None and os.getenv("HUGGINGFACE_EMAIL") != "":
|
||||||
|
hugginchat = textgeneration_huggingchat.build_example("Huggingchat", "huggingchat",admin_config)
|
||||||
|
bot_config.SUPPORTED_DVMS.append(hugginchat)
|
||||||
|
hugginchat.run()
|
||||||
|
|
||||||
|
hugginchatsum = summarization_huggingchat.build_example("Huggingchat Summarizer", "huggingchatsum", admin_config)
|
||||||
|
bot_config.SUPPORTED_DVMS.append(hugginchatsum)
|
||||||
|
hugginchatsum.run()
|
||||||
|
|
||||||
|
|
||||||
hugginchat = textgeneration_huggingchat.build_example("Huggingchat", "hugginchat", admin_config)
|
|
||||||
bot_config.SUPPORTED_DVMS.append(hugginchat)
|
|
||||||
hugginchat.run()
|
|
||||||
|
|
||||||
# Run the bot
|
# Run the bot
|
||||||
Bot(bot_config)
|
Bot(bot_config)
|
||||||
|
@ -58,6 +58,10 @@ class TextSummarizationHuggingChat(DVMTaskInterface):
|
|||||||
EventDefinitions.KIND_NIP90_RESULT_TRANSLATE_TEXT,
|
EventDefinitions.KIND_NIP90_RESULT_TRANSLATE_TEXT,
|
||||||
EventDefinitions.KIND_NIP90_RESULT_CONTENT_DISCOVERY],
|
EventDefinitions.KIND_NIP90_RESULT_CONTENT_DISCOVERY],
|
||||||
dvm_config=dvm_config)
|
dvm_config=dvm_config)
|
||||||
|
if evt is None:
|
||||||
|
print("Event not found")
|
||||||
|
raise Exception
|
||||||
|
|
||||||
if evt.kind() == EventDefinitions.KIND_NIP90_RESULT_CONTENT_DISCOVERY:
|
if evt.kind() == EventDefinitions.KIND_NIP90_RESULT_CONTENT_DISCOVERY:
|
||||||
result_list = json.loads(evt.content())
|
result_list = json.loads(evt.content())
|
||||||
prompt = ""
|
prompt = ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user