mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
feat: runtime block value
This commit is contained in:
@ -4,10 +4,9 @@ from runtime.ast.parser import Parser
|
||||
from runtime.ast.runtime import Runtime
|
||||
|
||||
script = """
|
||||
let hello = true
|
||||
let text = audio_to_text(audio)
|
||||
print(hello)
|
||||
return tts(text)
|
||||
let hello = add(div(1,2),2)
|
||||
|
||||
return hello
|
||||
"""
|
||||
|
||||
def version():
|
||||
@ -42,10 +41,7 @@ if __name__ == "__main__":
|
||||
"version": version,
|
||||
"print": print
|
||||
})
|
||||
ast = Parser().parse(script)
|
||||
# 注入數據
|
||||
script_output = runtime.run(Parser().parse(script), {
|
||||
"audio": audio_data
|
||||
})
|
||||
f = open("./test_data/runtime_output.mp3", "wb")
|
||||
f.write(script_output.read())
|
||||
f.close()
|
||||
script_output = runtime.run(ast, {})
|
||||
print("script:",script_output)
|
||||
Reference in New Issue
Block a user