diff --git a/templates/aistudio_gemini_prompt_freeform.ipynb b/templates/aistudio_gemini_prompt_freeform.ipynb index f825f90b..68c371a1 100644 --- a/templates/aistudio_gemini_prompt_freeform.ipynb +++ b/templates/aistudio_gemini_prompt_freeform.ipynb @@ -87,28 +87,6 @@ "from IPython.display import Markdown" ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "qZsRPVv1ITbh" - }, - "source": [ - "### Mount Google Drive" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "d9-t_OkGoLIP" - }, - "outputs": [], - "source": [ - "from google.colab import drive\n", - "\n", - "drive.mount(\"/gdrive\")" - ] - }, { "cell_type": "markdown", "metadata": { @@ -230,16 +208,19 @@ "cell_type": "code", "execution_count": null, "metadata": { - "cellView": "form", "id": "yoL3p3KPylFW" }, "outputs": [], "source": [ "# @title `show_file` function\n", + "drive = None\n", "def show_file(file_data):\n", " mime_type = file_data[\"mime_type\"]\n", "\n", " if drive_id := file_data.get(\"drive_id\", None):\n", + " if drive is None:\n", + " from google.colab import drive\n", + " drive.mount(\"/gdrive\")\n", " path = next(\n", " pathlib.Path(f\"/gdrive/.shortcut-targets-by-id/{drive_id}\").glob(\"*\")\n", " )\n", @@ -337,7 +318,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "cellView": "form", "id": "_wJAs_ZfuwCq" }, "outputs": [], @@ -347,10 +327,14 @@ "tempfiles = pathlib.Path(f\"tempfiles\")\n", "tempfiles.mkdir(parents=True, exist_ok=True)\n", "\n", - "\n", + "drive = None\n", "def upload_file_data(file_data):\n", " mime_type = file_data[\"mime_type\"]\n", " if drive_id := file_data.pop(\"drive_id\", None):\n", + " if drive is None:\n", + " from google.colab import drive\n", + " drive.mount(\"/gdrive\")\n", + "\n", " path = next(\n", " pathlib.Path(f\"/gdrive/.shortcut-targets-by-id/{drive_id}\").glob(\"*\")\n", " )\n",