diff --git a/runtime_example.py b/runtime_example.py index b12a6f5..87de98b 100644 --- a/runtime_example.py +++ b/runtime_example.py @@ -4,16 +4,15 @@ from runtime.ast.parser import Parser from runtime.ast.runtime import Runtime script = """ -let hello = add(div(1,2),2) - -return hello +let text = audio_to_text(audio) +return tts(text) """ def version(): return "0.0.1" -def add(a,b): - return a+b +def add(*args): + return sum(args) def div(a,b): return a/b @@ -43,5 +42,11 @@ if __name__ == "__main__": }) ast = Parser().parse(script) # 注入數據 - script_output = runtime.run(ast, {}) - print("script:",script_output) \ No newline at end of file + script_output = runtime.run(ast, { + "audio": audio_data, + }) + f = open("./test_data/tmp.wav", "wb") + print("script:", type(script_output)) + f.write(script_output.read()) + f.close() + \ No newline at end of file diff --git a/test_data/tmp.wav b/test_data/tmp.wav new file mode 100644 index 0000000..9675ea4 Binary files /dev/null and b/test_data/tmp.wav differ