future: rework functions to async to be compatible with newest nostrsdk

This commit is contained in:
Believethehype
2024-06-06 02:25:34 +02:00
parent f75ca73284
commit a286f4946e
43 changed files with 562 additions and 599 deletions

View File

@@ -29,13 +29,10 @@ class SpeechToTextGoogle(DVMTaskInterface):
dependencies = [("nostr-dvm", "nostr-dvm"),
("speech_recognition", "SpeechRecognition==3.10.0")]
def __init__(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None,
admin_config: AdminConfig = None, options=None):
async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None,
admin_config: AdminConfig = None, options=None):
dvm_config.SCRIPT = os.path.abspath(__file__)
super().__init__(name=name, dvm_config=dvm_config, nip89config=nip89config, nip88config=nip88config,
admin_config=admin_config, options=options)
if options is None:
self.options = {}
def is_input_supported(self, tags, client=None, dvm_config=None):
for tag in tags:
@@ -106,7 +103,7 @@ class SpeechToTextGoogle(DVMTaskInterface):
request_form['options'] = json.dumps(options)
return request_form
def process(self, request_form):
async def process(self, request_form):
import speech_recognition as sr
if self.options.get("api_key"):
api_key = self.options['api_key']