From a47ecb0575644e033af05ba02d8a06418cc31019 Mon Sep 17 00:00:00 2001 From: Inga Ulusoy Date: Thu, 10 Apr 2025 20:46:55 +0200 Subject: [PATCH] update notebook to include proper paths for sample data --- ...DemoNotebook_ammico_MultimodalSearch.ipynb | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/ammico/notebooks/DemoNotebook_ammico_MultimodalSearch.ipynb b/ammico/notebooks/DemoNotebook_ammico_MultimodalSearch.ipynb index 77dc23c..255d4c3 100644 --- a/ammico/notebooks/DemoNotebook_ammico_MultimodalSearch.ipynb +++ b/ammico/notebooks/DemoNotebook_ammico_MultimodalSearch.ipynb @@ -174,7 +174,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To process the loaded images using the selected model, use the below code:" + "To process the loaded images using the selected model, use the below code and substitute the path to your images:" ] }, { @@ -184,7 +184,7 @@ "outputs": [], "source": [ "image_dict = ammico.find_files(\n", - " path = \"../../../test-images-politicians\",\n", + " path = data_path,\n", ")" ] }, @@ -221,7 +221,7 @@ " features_image_stacked,\n", ") = my_obj.parsing_images(\n", " model_type, \n", - " path_to_save_tensors=\"../../../test-images-politicians\",\n", + " path_to_save_tensors=data_path,\n", " )" ] }, @@ -277,10 +277,10 @@ "metadata": {}, "outputs": [], "source": [ - "image_example_query = \"../../../test-images-politicians/5e4c7722-d620-42ab-915e-9b1a048e2992Original.jpg\" \n", + "image_example_query = data_path / \"img0.png\" \n", "\n", "search_query = [\n", - " {\"image\": image_example_query}, # This is how looks image query, here `image_example_path` is the path to query image like \"data/test-crop-image.png\"\n", + " {\"image\": str(image_example_query)}, # This is how looks image query, here `image_example_path` is the path to query image like \"data/test-crop-image.png\"\n", "]" ] }, @@ -388,12 +388,12 @@ "metadata": {}, "outputs": [], "source": [ - "image_example_query = \"../../../test-images-politicians/5e4c7722-d620-42ab-915e-9b1a048e2992Original.jpg\" # creating the path to the image for the image query example\n", - "image_example_query2 = \"../../../test-images-politicians/service-pnp-ppbd-00600-00608_150px.jpg\"\n", + "image_example_query = data_path / \"img0.png\" # creating the path to the image for the image query example\n", + "image_example_query2 = data_path / \"img1.png\"\n", "\n", "search_query = [\n", - " {\"image\": image_example_query}, # This is how looks image query, here `image_example_path` is the path to query image like \"data/test-crop-image.png\"\n", - " {\"image\": image_example_query2},\n", + " {\"image\": str(image_example_query)}, # This is how looks image query, here `image_example_path` is the path to query image like \"data/test-crop-image.png\"\n", + " {\"image\": str(image_example_query2)},\n", "]" ] }, @@ -464,7 +464,7 @@ "source": [ "# convert to dataframe\n", "df = ammico.get_dataframe(image_dict)\n", - "df" + "df.head(10)" ] }, { @@ -474,13 +474,20 @@ "outputs": [], "source": [ "# save to csv\n", - "df.to_csv(\"../../../test-images-politicians/data_out.csv\")" + "df.to_csv(data_path / \"data_out.csv\")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "ammico", "language": "python", "name": "python3" }, @@ -494,7 +501,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.21" + "version": "3.11.11" } }, "nbformat": 4,