{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "3b6cf083-3c0e-4e09-8c59-33898cf02a56", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "torch version: 2.5.1+cu118\n", "torchvision version: 0.20.1+cu118\n" ] } ], "source": [ "# For this notebook to run with updated APIs, we need torch 1.12+ and torchvision 0.13+\n", "try:\n", " import torch\n", " import torchvision\n", " print(f\"torch version: {torch.__version__}\")\n", " print(f\"torchvision version: {torchvision.__version__}\")\n", "except:\n", " print(f\"[INFO] torch/torchvision versions is not available\")" ] }, { "cell_type": "code", "execution_count": 29, "id": "7a6f0792-583a-4184-b562-4e2018cd0248", "metadata": {}, "outputs": [], "source": [ "# Continue with regular imports\n", "import matplotlib.pyplot as plt\n", "import torch\n", "import torchvision\n", "\n", "from torch import nn\n", "from torchvision import transforms\n", "\n", "# Try to get torchinfo, install it if it doesn't work\n", "try:\n", " from torchinfo import summary\n", "except:\n", " print(\"[INFO] Couldn't find torchinfo... installing it.\")\n", " !pip install -q torchinfo\n", " from torchinfo import summary\n", "\n", "# Try to import the going_modular directory, download it from GitHub if it doesn't work\n", "try:\n", " from going_modular import data_setup, engine\n", " from helper_functions import download_data, set_seeds, plot_loss_curves\n", "except:\n", " # Get the going_modular scripts\n", " print(\"[INFO] Couldn't find going_modular or helper_functions scripts... downloading them from GitHub.\")\n", " !git clone https://github.com/mrdbourke/pytorch-deep-learning\n", " !mv pytorch-deep-learning/going_modular .\n", " !mv pytorch-deep-learning/helper_functions.py . # get the helper_functions.py script\n", " !rm -rf pytorch-deep-learning\n", " from going_modular.going_modular import data_setup, engine\n", " from helper_functions import download_data, set_seeds, plot_loss_curves" ] }, { "cell_type": "code", "execution_count": 17, "id": "374e0096-9231-4ae9-80f0-4697ddea6042", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'cuda'" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n", "device" ] }, { "cell_type": "code", "execution_count": 5, "id": "2ea81a7e-ab88-4841-aa54-1bd234545c20", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Writing demos/foodvision_EfficientNet_B4/model.py\n" ] } ], "source": [ "%%writefile demos/foodvision_EfficientNet_B4/model.py\n", "import torch\n", "import torchvision\n", "\n", "from torch import nn\n", "\n", "def create_effnetb4_model(num_classes: int = 3, \n", " seed: int = 42):\n", " \"\"\"Creates an EfficientNetB4 feature extractor model and transforms.\n", "\n", " Args:\n", " num_classes (int, optional): number of classes in the classifier head. \n", " Defaults to 3.\n", " seed (int, optional): random seed value. Defaults to 42.\n", "\n", " Returns:\n", " model (torch.nn.Module): EffNetB4 feature extractor model. \n", " transforms (torchvision.transforms): EffNetB4 image transforms.\n", " \"\"\"\n", " # Create EffNetB4 pretrained weights, transforms and model\n", " weights = torchvision.models.EfficientNet_B4_Weights.DEFAULT\n", " transforms = weights.transforms()\n", " model = torchvision.models.efficientnet_b4(weights=weights)\n", "\n", " # Freeze all layers in base model\n", " for param in model.parameters():\n", " param.requires_grad = False\n", "\n", " # Change classifier head with random seed for reproducibility\n", " torch.manual_seed(seed)\n", " model.classifier = nn.Sequential(\n", " nn.Dropout(p=0.3, inplace=True),\n", " nn.Linear(in_features=1792, out_features=num_classes), # EfficientNetB4 uses 1792 features\n", " )\n", " \n", " return model, transforms\n" ] }, { "cell_type": "code", "execution_count": 6, "id": "3239b575-9069-4e21-a45a-42cb2d841e28", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Downloading: \"https://download.pytorch.org/models/efficientnet_b4_rwightman-23ab8bcd.pth\" to C:\\Users\\User/.cache\\torch\\hub\\checkpoints\\efficientnet_b4_rwightman-23ab8bcd.pth\n", "100%|█████████████████████████████████████████████████████████████████████████████| 74.5M/74.5M [00:06<00:00, 11.7MB/s]\n" ] } ], "source": [ "effnetb4_food101, effnetb4_transforms = create_effnetb4_model(num_classes=101)" ] }, { "cell_type": "code", "execution_count": 7, "id": "2da37181-179b-46fc-8f16-05b4705103c1", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "============================================================================================================================================\n", "Layer (type (var_name)) Input Shape Output Shape Param # Trainable\n", "============================================================================================================================================\n", "EfficientNet (EfficientNet) [1, 3, 224, 224] [1, 101] -- Partial\n", "├─Sequential (features) [1, 3, 224, 224] [1, 1792, 7, 7] -- False\n", "│ └─Conv2dNormActivation (0) [1, 3, 224, 224] [1, 48, 112, 112] -- False\n", "│ │ └─Conv2d (0) [1, 3, 224, 224] [1, 48, 112, 112] (1,296) False\n", "│ │ └─BatchNorm2d (1) [1, 48, 112, 112] [1, 48, 112, 112] (96) False\n", "│ │ └─SiLU (2) [1, 48, 112, 112] [1, 48, 112, 112] -- --\n", "│ └─Sequential (1) [1, 48, 112, 112] [1, 24, 112, 112] -- False\n", "│ │ └─MBConv (0) [1, 48, 112, 112] [1, 24, 112, 112] (2,940) False\n", "│ │ └─MBConv (1) [1, 24, 112, 112] [1, 24, 112, 112] (1,206) False\n", "│ └─Sequential (2) [1, 24, 112, 112] [1, 32, 56, 56] -- False\n", "│ │ └─MBConv (0) [1, 24, 112, 112] [1, 32, 56, 56] (11,878) False\n", "│ │ └─MBConv (1) [1, 32, 56, 56] [1, 32, 56, 56] (18,120) False\n", "│ │ └─MBConv (2) [1, 32, 56, 56] [1, 32, 56, 56] (18,120) False\n", "│ │ └─MBConv (3) [1, 32, 56, 56] [1, 32, 56, 56] (18,120) False\n", "│ └─Sequential (3) [1, 32, 56, 56] [1, 56, 28, 28] -- False\n", "│ │ └─MBConv (0) [1, 32, 56, 56] [1, 56, 28, 28] (25,848) False\n", "│ │ └─MBConv (1) [1, 56, 28, 28] [1, 56, 28, 28] (57,246) False\n", "│ │ └─MBConv (2) [1, 56, 28, 28] [1, 56, 28, 28] (57,246) False\n", "│ │ └─MBConv (3) [1, 56, 28, 28] [1, 56, 28, 28] (57,246) False\n", "│ └─Sequential (4) [1, 56, 28, 28] [1, 112, 14, 14] -- False\n", "│ │ └─MBConv (0) [1, 56, 28, 28] [1, 112, 14, 14] (70,798) False\n", "│ │ └─MBConv (1) [1, 112, 14, 14] [1, 112, 14, 14] (197,820) False\n", "│ │ └─MBConv (2) [1, 112, 14, 14] [1, 112, 14, 14] (197,820) False\n", "│ │ └─MBConv (3) [1, 112, 14, 14] [1, 112, 14, 14] (197,820) False\n", "│ │ └─MBConv (4) [1, 112, 14, 14] [1, 112, 14, 14] (197,820) False\n", "│ │ └─MBConv (5) [1, 112, 14, 14] [1, 112, 14, 14] (197,820) False\n", "│ └─Sequential (5) [1, 112, 14, 14] [1, 160, 14, 14] -- False\n", "│ │ └─MBConv (0) [1, 112, 14, 14] [1, 160, 14, 14] (240,924) False\n", "│ │ └─MBConv (1) [1, 160, 14, 14] [1, 160, 14, 14] (413,160) False\n", "│ │ └─MBConv (2) [1, 160, 14, 14] [1, 160, 14, 14] (413,160) False\n", "│ │ └─MBConv (3) [1, 160, 14, 14] [1, 160, 14, 14] (413,160) False\n", "│ │ └─MBConv (4) [1, 160, 14, 14] [1, 160, 14, 14] (413,160) False\n", "│ │ └─MBConv (5) [1, 160, 14, 14] [1, 160, 14, 14] (413,160) False\n", "│ └─Sequential (6) [1, 160, 14, 14] [1, 272, 7, 7] -- False\n", "│ │ └─MBConv (0) [1, 160, 14, 14] [1, 272, 7, 7] (520,904) False\n", "│ │ └─MBConv (1) [1, 272, 7, 7] [1, 272, 7, 7] (1,159,332) False\n", "│ │ └─MBConv (2) [1, 272, 7, 7] [1, 272, 7, 7] (1,159,332) False\n", "│ │ └─MBConv (3) [1, 272, 7, 7] [1, 272, 7, 7] (1,159,332) False\n", "│ │ └─MBConv (4) [1, 272, 7, 7] [1, 272, 7, 7] (1,159,332) False\n", "│ │ └─MBConv (5) [1, 272, 7, 7] [1, 272, 7, 7] (1,159,332) False\n", "│ │ └─MBConv (6) [1, 272, 7, 7] [1, 272, 7, 7] (1,159,332) False\n", "│ │ └─MBConv (7) [1, 272, 7, 7] [1, 272, 7, 7] (1,159,332) False\n", "│ └─Sequential (7) [1, 272, 7, 7] [1, 448, 7, 7] -- False\n", "│ │ └─MBConv (0) [1, 272, 7, 7] [1, 448, 7, 7] (1,420,804) False\n", "│ │ └─MBConv (1) [1, 448, 7, 7] [1, 448, 7, 7] (3,049,200) False\n", "│ └─Conv2dNormActivation (8) [1, 448, 7, 7] [1, 1792, 7, 7] -- False\n", "│ │ └─Conv2d (0) [1, 448, 7, 7] [1, 1792, 7, 7] (802,816) False\n", "│ │ └─BatchNorm2d (1) [1, 1792, 7, 7] [1, 1792, 7, 7] (3,584) False\n", "│ │ └─SiLU (2) [1, 1792, 7, 7] [1, 1792, 7, 7] -- --\n", "├─AdaptiveAvgPool2d (avgpool) [1, 1792, 7, 7] [1, 1792, 1, 1] -- --\n", "├─Sequential (classifier) [1, 1792] [1, 101] -- True\n", "│ └─Dropout (0) [1, 1792] [1, 1792] -- --\n", "│ └─Linear (1) [1, 1792] [1, 101] 181,093 True\n", "============================================================================================================================================\n", "Total params: 17,729,709\n", "Trainable params: 181,093\n", "Non-trainable params: 17,548,616\n", "Total mult-adds (Units.GIGABYTES): 1.50\n", "============================================================================================================================================\n", "Input size (MB): 0.60\n", "Forward/backward pass size (MB): 272.49\n", "Params size (MB): 70.92\n", "Estimated Total Size (MB): 344.01\n", "============================================================================================================================================" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from torchinfo import summary\n", "\n", "# # Get a summary of EffNetB2 feature extractor for Food101 with 101 output classes (uncomment for full output)\n", "summary(effnetb4_food101, \n", " input_size=(1, 3, 224, 224),\n", " col_names=[\"input_size\", \"output_size\", \"num_params\", \"trainable\"],\n", " col_width=20,\n", " row_settings=[\"var_names\"])" ] }, { "cell_type": "code", "execution_count": 8, "id": "23bd126b-fc5a-497d-bb92-abbf7bb1ef29", "metadata": {}, "outputs": [], "source": [ "# Create Food101 training data transforms (only perform data augmentation on the training images)\n", "food101_train_transforms = torchvision.transforms.Compose([\n", " torchvision.transforms.TrivialAugmentWide(),\n", " effnetb4_transforms,\n", "])" ] }, { "cell_type": "code", "execution_count": 9, "id": "10142abc-6621-4845-a257-5a257748d58a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Training transforms:\n", "Compose(\n", " TrivialAugmentWide(num_magnitude_bins=31, interpolation=InterpolationMode.NEAREST, fill=None)\n", " ImageClassification(\n", " crop_size=[380]\n", " resize_size=[384]\n", " mean=[0.485, 0.456, 0.406]\n", " std=[0.229, 0.224, 0.225]\n", " interpolation=InterpolationMode.BICUBIC\n", ")\n", ")\n", "\n", "Testing transforms:\n", "ImageClassification(\n", " crop_size=[380]\n", " resize_size=[384]\n", " mean=[0.485, 0.456, 0.406]\n", " std=[0.229, 0.224, 0.225]\n", " interpolation=InterpolationMode.BICUBIC\n", ")\n" ] } ], "source": [ "print(f\"Training transforms:\\n{food101_train_transforms}\\n\") \n", "print(f\"Testing transforms:\\n{effnetb4_transforms}\")" ] }, { "cell_type": "code", "execution_count": 11, "id": "9ddd0099-b96d-4dca-af1f-e8659fc1572b", "metadata": {}, "outputs": [], "source": [ "from torchvision import datasets\n", "\n", "# Setup data directory\n", "from pathlib import Path\n", "data_dir = Path(\"data\")\n", "\n", "# Get training data (~750 images x 101 food classes)\n", "train_data = datasets.Food101(root=data_dir, # path to download data to\n", " split=\"train\", # dataset split to get\n", " transform=food101_train_transforms, # perform data augmentation on training data\n", " download=True) # want to download?\n", "\n", "# Get testing data (~250 images x 101 food classes)\n", "test_data = datasets.Food101(root=data_dir,\n", " split=\"test\",\n", " transform=effnetb4_transforms, # perform normal EffNetB2 transforms on test data\n", " download=True)" ] }, { "cell_type": "code", "execution_count": 12, "id": "9db8b0fd-6274-4e38-bb83-24d34afaa109", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['apple_pie',\n", " 'baby_back_ribs',\n", " 'baklava',\n", " 'beef_carpaccio',\n", " 'beef_tartare',\n", " 'beet_salad',\n", " 'beignets',\n", " 'bibimbap',\n", " 'bread_pudding',\n", " 'breakfast_burrito']" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Get Food101 class names\n", "food101_class_names = train_data.classes\n", "\n", "# View the first 10\n", "food101_class_names[:10]" ] }, { "cell_type": "code", "execution_count": 13, "id": "dc65c3c6-341b-491b-a338-6afff4deb6b2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(75750, 25250)" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(train_data), len(test_data)" ] }, { "cell_type": "code", "execution_count": 15, "id": "e92762a7-a2ae-4321-be8d-f3a4e72d8c47", "metadata": {}, "outputs": [], "source": [ "import os\n", "import torch\n", "\n", "BATCH_SIZE = 24 # 從32調整至24減少顯存壓力\n", "NUM_WORKERS = 2 if os.cpu_count() <= 4 else 4 # this value is very experimental and will depend on the hardware you have available, Google Colab generally provides 2x CPUs\n", "\n", "# Create Food101 20 percent training DataLoader\n", "train_dataloader_food101 = torch.utils.data.DataLoader(train_data,\n", " batch_size=BATCH_SIZE,\n", " shuffle=True,\n", " num_workers=NUM_WORKERS)\n", "# Create Food101 20 percent testing DataLoader\n", "test_dataloader_food101 = torch.utils.data.DataLoader(test_data,\n", " batch_size=BATCH_SIZE,\n", " shuffle=False,\n", " num_workers=NUM_WORKERS)" ] }, { "cell_type": "code", "execution_count": 18, "id": "5f6c3a8b-2e77-4632-9ed8-996cef860ac8", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "a0297f87af20472786ebcec49ac131cc", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/10 [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from helper_functions import plot_loss_curves\n", "\n", "# Check out the loss curves for FoodVision Big\n", "plot_loss_curves(effnetb4_food101_results)" ] }, { "cell_type": "code", "execution_count": 20, "id": "c7ce3e64-0587-46e6-8006-2fbb3b4a7ba5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[INFO] Saving model to: models\\effnetb4_food101.pth\n" ] } ], "source": [ "from going_modular import utils\n", "\n", "# Create a model path\n", "effnetb4_food101_model_path = \"effnetb4_food101.pth\" \n", "\n", "# Save FoodVision Big model\n", "utils.save_model(model=effnetb4_food101,\n", " target_dir=\"models\",\n", " model_name=effnetb4_food101_model_path)" ] }, { "cell_type": "code", "execution_count": 21, "id": "ab324b7c-e71b-4203-a6b4-8b42d7d7c7d8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Pretrained EffNetB2 feature extractor Food101 model size: 68 MB\n" ] } ], "source": [ "from pathlib import Path\n", "\n", "# Get the model size in bytes then convert to megabytes\n", "pretrained_effnetb4_food101_model_size = Path(\"models\", effnetb4_food101_model_path).stat().st_size // (1024*1024) # division converts bytes to megabytes (roughly) \n", "print(f\"Pretrained EffNetB2 feature extractor Food101 model size: {pretrained_effnetb4_food101_model_size} MB\")" ] }, { "cell_type": "code", "execution_count": 24, "id": "8ba7d7ad-1484-472e-bce7-1d86aa1ae555", "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "# Create FoodVision Big demo path\n", "foodvision_big_demo_path = Path(\"demos/foodvision_EfficientNet_B4/\")\n", "\n", "# Make FoodVision Big demo examples directory\n", "(foodvision_big_demo_path / \"examples\").mkdir(parents=True, exist_ok=True)" ] }, { "cell_type": "code", "execution_count": 25, "id": "226455a4-abc1-4296-8d47-c9dfff99d0b2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['apple_pie',\n", " 'baby_back_ribs',\n", " 'baklava',\n", " 'beef_carpaccio',\n", " 'beef_tartare',\n", " 'beet_salad',\n", " 'beignets',\n", " 'bibimbap',\n", " 'bread_pudding',\n", " 'breakfast_burrito']" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Check out the first 10 Food101 class names\n", "food101_class_names[:10]" ] }, { "cell_type": "code", "execution_count": 26, "id": "5f69e1a6-d00f-43f9-a9b8-23663b0fd6d9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[INFO] Saving Food101 class names to demos\\foodvision_EfficientNet_B4\\class_names.txt\n" ] } ], "source": [ "# Create path to Food101 class names\n", "foodvision_big_class_names_path = foodvision_big_demo_path / \"class_names.txt\"\n", "\n", "# Write Food101 class names list to file\n", "with open(foodvision_big_class_names_path, \"w\") as f:\n", " print(f\"[INFO] Saving Food101 class names to {foodvision_big_class_names_path}\")\n", " f.write(\"\\n\".join(food101_class_names)) # leave a new line between each class" ] }, { "cell_type": "code", "execution_count": 27, "id": "2d1819cc-aeea-4c45-a85f-a0f6d900e527", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['apple_pie', 'baby_back_ribs', 'baklava', 'beef_carpaccio', 'beef_tartare']" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Open Food101 class names file and read each line into a list\n", "with open(foodvision_big_class_names_path, \"r\") as f:\n", " food101_class_names_loaded = [food.strip() for food in f.readlines()]\n", " \n", "# View the first 5 class names loaded back in\n", "food101_class_names_loaded[:5]" ] }, { "cell_type": "code", "execution_count": 28, "id": "9e492162-6b11-4362-9278-cad3562ba33e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Writing demos/foodvision_EfficientNet_B4/app.py\n" ] } ], "source": [ "%%writefile demos/foodvision_EfficientNet_B4/app.py\n", "### 1. Imports and class names setup ### \n", "import gradio as gr\n", "import os\n", "import torch\n", "\n", "from model import create_effnetb2_model\n", "from timeit import default_timer as timer\n", "from typing import Tuple, Dict\n", "\n", "# Setup class names\n", "with open(\"class_names.txt\", \"r\") as f: # reading them in from class_names.txt\n", " class_names = [food_name.strip() for food_name in f.readlines()]\n", " \n", "### 2. Model and transforms preparation ### \n", "\n", "# Create model\n", "effnetb4, effnetb4_transforms = create_effnetb4_model(\n", " num_classes=101, # could also use len(class_names)\n", ")\n", "\n", "# Load saved weights\n", "effnetb4.load_state_dict(\n", " torch.load(\n", " f=\"effnetb4_food101.pth\",\n", " map_location=torch.device(\"cpu\"), # load to CPU\n", " )\n", ")\n", "\n", "### 3. Predict function ###\n", "\n", "# Create predict function\n", "def predict(img) -> Tuple[Dict, float]:\n", " \"\"\"Transforms and performs a prediction on img and returns prediction and time taken.\n", " \"\"\"\n", " # Start the timer\n", " start_time = timer()\n", " \n", " # Transform the target image and add a batch dimension\n", " img = effnetb4_transforms(img).unsqueeze(0)\n", " \n", " # Put model into evaluation mode and turn on inference mode\n", " effnetb4.eval()\n", " with torch.inference_mode():\n", " # Pass the transformed image through the model and turn the prediction logits into prediction probabilities\n", " pred_probs = torch.softmax(effnetb4(img), dim=1)\n", " \n", " # Create a prediction label and prediction probability dictionary for each prediction class (this is the required format for Gradio's output parameter)\n", " pred_labels_and_probs = {class_names[i]: float(pred_probs[0][i]) for i in range(len(class_names))}\n", " \n", " # Calculate the prediction time\n", " pred_time = round(timer() - start_time, 5)\n", " \n", " # Return the prediction dictionary and prediction time \n", " return pred_labels_and_probs, pred_time\n", "\n", "### 4. Gradio app ###\n", "\n", "# Create title, description and article strings\n", "title = \"Food101Vision 🍔\"\n", "description = \"An EfficientNetB4 feature extractor computer vision model to classify images of food into 101 different classes (Food101)\"\n", "# Create examples list from \"examples/\" directory\n", "example_list = [[\"examples/\" + example] for example in os.listdir(\"examples\")]\n", "\n", "# Create Gradio interface \n", "demo = gr.Interface(\n", " fn=predict,\n", " inputs=gr.Image(type=\"pil\"),\n", " outputs=[\n", " gr.Label(num_top_classes=5, label=\"Predictions\"),\n", " gr.Number(label=\"Prediction time (s)\"),\n", " ],\n", " examples=example_list,\n", " title=title,\n", " description=description\n", ")\n", "\n", "# Launch the app!\n", "demo.launch(debug=False) # Don't need share=True in Hugging Face" ] }, { "cell_type": "code", "execution_count": null, "id": "ec37a50e-163e-464b-beca-74ffe72517d5", "metadata": {}, "outputs": [], "source": [ "%%writefile demos/foodvision_EfficientNet_B4/requirements.txt\n", "torch==1.12.0\n", "torchvision==0.13.0\n", "gradio==3.1.4" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.7" } }, "nbformat": 4, "nbformat_minor": 5 }