Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
believethehype committed Dec 15, 2023
1 parent 9f85809 commit dca65f2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 24 deletions.
11 changes: 5 additions & 6 deletions nostr_dvm/tasks/imagegeneration_replicate_sdxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def create_request_from_nostr_event(self, event, client=None, dvm_config=None):
width = "1024"
height = "1024"


for tag in event.tags():
if tag.as_vec()[0] == 'i':
input_type = tag.as_vec()[2]
Expand Down Expand Up @@ -116,6 +115,7 @@ def process(self, request_form):
print("Error in Module")
raise Exception(e)


# 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
# playground or elsewhere
Expand All @@ -139,13 +139,12 @@ def build_example(name, identifier, admin_config):
}
}


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)
# We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89
return ImageGenerationReplicateSDXL(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config)

return ImageGenerationReplicateSDXL(name=name, dvm_config=dvm_config, nip89config=nip89config,
admin_config=admin_config)


if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions nostr_dvm/tasks/textextraction_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ def build_example(name, identifier, admin_config):
}
}
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)

return SpeechToTextGoogle(name=name, dvm_config=dvm_config, nip89config=nip89config,
admin_config=admin_config, options=options)

Expand Down
9 changes: 4 additions & 5 deletions nostr_dvm/tasks/textgeneration_llmlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def build_example(name, identifier, admin_config):
dvm_config = build_default_config(identifier)
admin_config.LUD16 = dvm_config.LN_ADDRESS

options = {'default_model': "ollama/llama2-uncensored", 'server': "http://localhost:11434"}

nip89info = {
"name": name,
"image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg",
Expand All @@ -116,13 +118,10 @@ def build_example(name, identifier, admin_config):
}
}

options = {'default_model': "ollama/llama2-uncensored", 'server': "http://localhost:11434"}

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)
# We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89

return TextGenerationOLLAMA(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options)


Expand Down
4 changes: 2 additions & 2 deletions nostr_dvm/tasks/translation_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def build_example(name, identifier, admin_config):
}
}
nip89config = NIP89Config()
nip89config.DTAG = 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)

return TranslationGoogle(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config)

if __name__ == '__main__':
Expand Down
12 changes: 3 additions & 9 deletions nostr_dvm/tasks/trending_notes_nostrband.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ def process(self, request_form):
except:
return "error"





def post_process(self, result, event):
"""Overwrite the interface function to return a social client readable format, if requested"""
for tag in event.tags():
Expand Down Expand Up @@ -114,14 +110,12 @@ def build_example(name, identifier, admin_config):
"cashuAccepted": True,
"nip90Params": {}
}

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)

return TrendingNotesNostrBand(name=name, dvm_config=dvm_config, nip89config=nip89config,
admin_config=admin_config)
admin_config=admin_config)


if __name__ == '__main__':
Expand Down

0 comments on commit dca65f2

Please sign in to comment.