diff --git a/azureml/cxrreportgen/simplified_end_to_end_demo.ipynb b/azureml/cxrreportgen/simplified_end_to_end_demo.ipynb new file mode 100644 index 0000000..66fe612 --- /dev/null +++ b/azureml/cxrreportgen/simplified_end_to_end_demo.ipynb @@ -0,0 +1,114 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "71149c27", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import os\n", + "from pathlib import Path\n", + "from dotenv import load_dotenv\n", + "load_dotenv()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ca666a25", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Files in cxrreportgen-images:\n", + "pathology_breast.png\n" + ] + }, + { + "ename": "FileNotFoundError", + "evalue": "[Errno 2] No such file or directory: 'C:\\\\Users\\\\User\\\\healthcareai-examples\\\\data\\\\healthcare-ai\\\\cxrreportgen-images\\\\00000001_000.png'", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mFileNotFoundError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[7]\u001b[39m\u001b[32m, line 19\u001b[39m\n\u001b[32m 16\u001b[39m sample_path = cxr_folder / sample_filename\n\u001b[32m 18\u001b[39m \u001b[38;5;66;03m# Load & show\u001b[39;00m\n\u001b[32m---> \u001b[39m\u001b[32m19\u001b[39m img = \u001b[43mImage\u001b[49m\u001b[43m.\u001b[49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[43msample_path\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 20\u001b[39m plt.figure(figsize=(\u001b[32m10\u001b[39m, \u001b[32m10\u001b[39m))\n\u001b[32m 21\u001b[39m plt.imshow(img, cmap=\u001b[33m\"\u001b[39m\u001b[33mgray\u001b[39m\u001b[33m\"\u001b[39m)\n", + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PIL\\Image.py:3513\u001b[39m, in \u001b[36mopen\u001b[39m\u001b[34m(fp, mode, formats)\u001b[39m\n\u001b[32m 3511\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m is_path(fp):\n\u001b[32m 3512\u001b[39m filename = os.fspath(fp)\n\u001b[32m-> \u001b[39m\u001b[32m3513\u001b[39m fp = \u001b[43mbuiltins\u001b[49m\u001b[43m.\u001b[49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mrb\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[32m 3514\u001b[39m exclusive_fp = \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[32m 3515\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n", + "\u001b[31mFileNotFoundError\u001b[39m: [Errno 2] No such file or directory: 'C:\\\\Users\\\\User\\\\healthcareai-examples\\\\data\\\\healthcare-ai\\\\cxrreportgen-images\\\\00000001_000.png'" + ] + } + ], + "source": [ + "from pathlib import Path\n", + "import matplotlib.pyplot as plt\n", + "from PIL import Image\n", + "\n", + "# Your exact full path on Windows\n", + "cxr_folder = Path(r\"C:\\Users\\User\\healthcareai-examples\\data\\healthcare-ai\\cxrreportgen-images\")\n", + "\n", + "# List all files to confirm what's there\n", + "print(\"Files in cxrreportgen-images folder:\")\n", + "for file in cxr_folder.iterdir():\n", + " if file.is_file():\n", + " print(file.name)\n", + "\n", + "# Available real files: cxr_frontal.jpg and cxr_lateral.jpg (plus possibly pathology_breast.png)\n", + "\n", + "# Pick the frontal chest X-ray (main sample for report generation)\n", + "sample_filename = \"cxr_frontal.jpg\" # This definitely exists\n", + "\n", + "sample_path = cxr_folder / sample_filename\n", + "\n", + "# Load and display the image\n", + "img = Image.open(sample_path)\n", + "\n", + "plt.figure(figsize=(10, 10))\n", + "plt.imshow(img, cmap=\"gray\") # 'gray' for medical X-ray look\n", + "plt.title(\"Sample Chest X-ray (Frontal View) for CXRReportGen Demo\")\n", + "plt.axis(\"off\")\n", + "plt.show()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}