diff --git a/basic_training_notebook.ipynb b/basic_training_notebook.ipynb index 925e431..30b6e40 100644 --- a/basic_training_notebook.ipynb +++ b/basic_training_notebook.ipynb @@ -542,18 +542,47 @@ "outputs": [], "source": [ "import shutil\n", + "import json\n", "from IPython.display import FileLink\n", "\n", - "# Define the source path and desired download location\n", + "# Define the source path and desired download location for the TFLite file\n", "source_path = \"trained_models/wakeword/tflite_stream_state_internal_quant/stream_state_internal_quant.tflite\"\n", "destination_path = \"./stream_state_internal_quant.tflite\"\n", "\n", - "# Copy the file to the current working directory\n", + "# Copy the TFLite file to the current working directory\n", "shutil.copy(source_path, destination_path)\n", "\n", - "# Generate a link to download the file\n", - "print(\"Download your file:\")\n", - "FileLink(destination_path)" + "# Define the JSON file content\n", + "json_data = {\n", + " \"type\": \"micro\",\n", + " \"wake_word\": \"khum_puter\", # Adjust this if the target_word changes dynamically\n", + " \"author\": \"master phooey\",\n", + " \"website\": \"https://github.com/MasterPhooey/MicroWakeWord-Trainer-Docker\",\n", + " \"model\": \"stream_state_internal_quant.tflite\",\n", + " \"trained_languages\": [\"en\"],\n", + " \"version\": 2,\n", + " \"micro\": {\n", + " \"probability_cutoff\": 0.97,\n", + " \"sliding_window_size\": 5,\n", + " \"feature_step_size\": 10,\n", + " \"tensor_arena_size\": 30000,\n", + " \"minimum_esphome_version\": \"2024.7.0\"\n", + " }\n", + "}\n", + "\n", + "# Define the JSON file path\n", + "json_path = \"./stream_state_internal_quant.json\"\n", + "\n", + "# Write the JSON file\n", + "with open(json_path, \"w\") as json_file:\n", + " json.dump(json_data, json_file, indent=2)\n", + "\n", + "# Generate download links for both files\n", + "print(\"Download your files:\")\n", + "print(\"TFLite Model:\")\n", + "display(FileLink(destination_path))\n", + "print(\"\\nJSON Metadata:\")\n", + "display(FileLink(json_path))" ] } ],