diff --git a/wasmedge-chatTTS/README.md b/wasmedge-chatTTS/README.md
index d897aa2..139e88b 100644
--- a/wasmedge-chatTTS/README.md
+++ b/wasmedge-chatTTS/README.md
@@ -58,5 +58,12 @@ let config_data = serde_json::to_string(&json!({"prompt": "[oral_2][laugh_0][bre
.as_bytes()
.to_vec();
```
+
+
+
-And it is the [Demo speaker](./assets/demo.wav).
+[demo.webm](https://github.com/user-attachments/assets/377e0487-9107-41db-9c22-31962ce53f88)
+
+ |
+
+
\ No newline at end of file
diff --git a/wasmedge-chatTTS/assets/demo.webm b/wasmedge-chatTTS/assets/demo.webm
new file mode 100644
index 0000000..9a1f52c
Binary files /dev/null and b/wasmedge-chatTTS/assets/demo.webm differ
diff --git a/wasmedge-chatTTS/src/main.rs b/wasmedge-chatTTS/src/main.rs
index 8e01d35..7af21f5 100644
--- a/wasmedge-chatTTS/src/main.rs
+++ b/wasmedge-chatTTS/src/main.rs
@@ -4,14 +4,14 @@ use wasmedge_wasi_nn::{
self, ExecutionTarget, GraphBuilder, GraphEncoding, GraphExecutionContext, TensorType,
};
-fn get_data_from_context(context: &GraphExecutionContext, index: usize, limit: usize) -> Vec {
+fn get_data_from_context(context: &GraphExecutionContext, index: usize) -> Vec {
const MAX_OUTPUT_BUFFER_SIZE: usize = 4096 * 4096;
let mut output_buffer = vec![0u8; MAX_OUTPUT_BUFFER_SIZE];
- let _ = context
+ let bytes_written = context
.get_output(index, &mut output_buffer)
.expect("Failed to get output");
- return output_buffer[..limit].to_vec();
+ return output_buffer[..bytes_written].to_vec();
}
fn main() {
@@ -35,9 +35,7 @@ fn main() {
.set_input(1, TensorType::U8, &[1], &config_data)
.expect("Failed to set input");
context.compute().expect("Failed to compute");
- let bytes_written = get_data_from_context(&context, 1, 4);
- let bytes_written = usize::from_le_bytes(bytes_written.as_slice().try_into().unwrap());
- let output_bytes = get_data_from_context(&context, 0, bytes_written);
+ let output_bytes = get_data_from_context(&context, 0);
let spec = hound::WavSpec {
channels: 1,
sample_rate: 24000,