{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "ename": "ModuleNotFoundError", "evalue": "No module named 'gradio'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[1], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m#|export\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mfastai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mvision\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mall\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[0;32m----> 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgradio\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mgr\u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mis_rocky\u001b[39m(x): \u001b[38;5;28;01mreturn\u001b[39;00m x[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39misupper()\n", "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'gradio'" ] } ], "source": [ "#|export\n", "from fastai.vision.all import *\n", "import gradio as gr\n", "\n", "def is_rocky(x): return x[0].isupper()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting gradio\n", " Downloading gradio-3.16.2-py3-none-any.whl (14.2 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m14.2/14.2 MB\u001b[0m \u001b[31m31.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hRequirement already satisfied: markupsafe in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (2.1.2)\n", "Collecting orjson\n", " Downloading orjson-3.8.5-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (489 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m489.2/489.2 kB\u001b[0m \u001b[31m10.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m\n", "\u001b[?25hRequirement already satisfied: typing-extensions in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (4.4.0)\n", "Collecting aiofiles\n", " Downloading aiofiles-22.1.0-py3-none-any.whl (14 kB)\n", "Collecting pydub\n", " Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n", "Collecting httpx\n", " Downloading httpx-0.23.3-py3-none-any.whl (71 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m71.5/71.5 kB\u001b[0m \u001b[31m3.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting pycryptodome\n", " Downloading pycryptodome-3.16.0.tar.gz (4.5 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4.5/4.5 MB\u001b[0m \u001b[31m8.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0mm\n", "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25ldone\n", "\u001b[?25hRequirement already satisfied: pydantic in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (1.10.4)\n", "Requirement already satisfied: jinja2 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (3.1.2)\n", "Requirement already satisfied: requests in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (2.28.2)\n", "Collecting altair>=4.2.0\n", " Downloading altair-4.2.0-py3-none-any.whl (812 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m812.8/812.8 kB\u001b[0m \u001b[31m17.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m\n", "\u001b[?25hRequirement already satisfied: matplotlib in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (3.6.3)\n", "Collecting ffmpy\n", " Downloading ffmpy-0.3.0.tar.gz (4.8 kB)\n", " Preparing metadata (setup.py) ... \u001b[?25ldone\n", "\u001b[?25hRequirement already satisfied: pandas in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (1.5.3)\n", "Collecting fsspec\n", " Downloading fsspec-2023.1.0-py3-none-any.whl (143 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m143.0/143.0 kB\u001b[0m \u001b[31m5.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting uvicorn\n", " Downloading uvicorn-0.20.0-py3-none-any.whl (56 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m56.9/56.9 kB\u001b[0m \u001b[31m2.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting aiohttp\n", " Downloading aiohttp-3.8.3-cp310-cp310-macosx_11_0_arm64.whl (336 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m336.4/336.4 kB\u001b[0m \u001b[31m11.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting python-multipart\n", " Downloading python-multipart-0.0.5.tar.gz (32 kB)\n", " Preparing metadata (setup.py) ... \u001b[?25ldone\n", "\u001b[?25hRequirement already satisfied: numpy in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (1.24.1)\n", "Requirement already satisfied: pyyaml in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (6.0)\n", "Collecting fastapi\n", " Downloading fastapi-0.89.1-py3-none-any.whl (55 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m55.8/55.8 kB\u001b[0m \u001b[31m2.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting websockets>=10.0\n", " Downloading websockets-10.4-cp310-cp310-macosx_11_0_arm64.whl (97 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m97.9/97.9 kB\u001b[0m \u001b[31m4.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting markdown-it-py[linkify,plugins]\n", " Downloading markdown_it_py-2.1.0-py3-none-any.whl (84 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m84.5/84.5 kB\u001b[0m \u001b[31m3.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: pillow in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (9.4.0)\n", "Requirement already satisfied: jsonschema>=3.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from altair>=4.2.0->gradio) (4.17.3)\n", "Requirement already satisfied: toolz in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from altair>=4.2.0->gradio) (0.12.0)\n", "Requirement already satisfied: entrypoints in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from altair>=4.2.0->gradio) (0.4)\n", "Requirement already satisfied: python-dateutil>=2.8.1 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from pandas->gradio) (2.8.2)\n", "Requirement already satisfied: pytz>=2020.1 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from pandas->gradio) (2022.7.1)\n", "Collecting yarl<2.0,>=1.0\n", " Downloading yarl-1.8.2-cp310-cp310-macosx_11_0_arm64.whl (57 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.9/57.9 kB\u001b[0m \u001b[31m2.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: attrs>=17.3.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from aiohttp->gradio) (22.2.0)\n", "Collecting frozenlist>=1.1.1\n", " Downloading frozenlist-1.3.3-cp310-cp310-macosx_11_0_arm64.whl (34 kB)\n", "Collecting multidict<7.0,>=4.5\n", " Downloading multidict-6.0.4-cp310-cp310-macosx_11_0_arm64.whl (29 kB)\n", "Collecting aiosignal>=1.1.2\n", " Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)\n", "Collecting async-timeout<5.0,>=4.0.0a3\n", " Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)\n", "Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from aiohttp->gradio) (2.1.1)\n", "Collecting starlette==0.22.0\n", " Downloading starlette-0.22.0-py3-none-any.whl (64 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m64.3/64.3 kB\u001b[0m \u001b[31m2.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: anyio<5,>=3.4.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from starlette==0.22.0->fastapi->gradio) (3.6.2)\n", "Requirement already satisfied: sniffio in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from httpx->gradio) (1.3.0)\n", "Requirement already satisfied: certifi in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from httpx->gradio) (2022.12.7)\n", "Collecting httpcore<0.17.0,>=0.15.0\n", " Downloading httpcore-0.16.3-py3-none-any.whl (69 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m69.6/69.6 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting rfc3986[idna2008]<2,>=1.3\n", " Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)\n", "Collecting mdurl~=0.1\n", " Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)\n", "Collecting linkify-it-py~=1.0\n", " Downloading linkify_it_py-1.0.3-py3-none-any.whl (19 kB)\n", "Collecting mdit-py-plugins\n", " Downloading mdit_py_plugins-0.3.3-py3-none-any.whl (50 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m50.5/50.5 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: kiwisolver>=1.0.1 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (1.4.4)\n", "Requirement already satisfied: packaging>=20.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (23.0)\n", "Requirement already satisfied: fonttools>=4.22.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (4.38.0)\n", "Requirement already satisfied: pyparsing>=2.2.1 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (3.0.9)\n", "Requirement already satisfied: cycler>=0.10 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (0.11.0)\n", "Requirement already satisfied: contourpy>=1.0.1 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (1.0.7)\n", "Requirement already satisfied: six>=1.4.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from python-multipart->gradio) (1.16.0)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from requests->gradio) (1.26.14)\n", "Requirement already satisfied: idna<4,>=2.5 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from requests->gradio) (3.4)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: click>=7.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from uvicorn->gradio) (8.1.3)\n", "Collecting h11>=0.8\n", " Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m2.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from jsonschema>=3.0->altair>=4.2.0->gradio) (0.19.3)\n", "Collecting uc-micro-py\n", " Downloading uc_micro_py-1.0.1-py3-none-any.whl (6.2 kB)\n", "Building wheels for collected packages: ffmpy, pycryptodome, python-multipart\n", " Building wheel for ffmpy (setup.py) ... \u001b[?25ldone\n", "\u001b[?25h Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4693 sha256=b13c4d156ac37781713a9351ed85757eb299234a8aeba609bdd283b0b76913d2\n", " Stored in directory: /Users/christoph.schmitz@schibsted.com/Library/Caches/pip/wheels/fe/17/e9/577da024bc5aede641c69f0675254c1e518db79800abbe135c\n", " Building wheel for pycryptodome (setup.py) ... \u001b[?25ldone\n", "\u001b[?25h Created wheel for pycryptodome: filename=pycryptodome-3.16.0-cp35-abi3-macosx_11_0_arm64.whl size=1532741 sha256=cfb1d46136a9e580af55bae62d364564cd319868f62483eda575f09abd8dd6c1\n", " Stored in directory: /Users/christoph.schmitz@schibsted.com/Library/Caches/pip/wheels/7a/8a/76/6e5de52adfb0dee5462d54b54a610e9b5215c056d6876ce3ce\n", " Building wheel for python-multipart (setup.py) ... \u001b[?25ldone\n", "\u001b[?25h Created wheel for python-multipart: filename=python_multipart-0.0.5-py3-none-any.whl size=31670 sha256=705092b4ca635b008df23e58f42871e4acac7ba9b7899e3545afe8ca12995666\n", " Stored in directory: /Users/christoph.schmitz@schibsted.com/Library/Caches/pip/wheels/1a/70/03/c981b93a16009e0e54f9f16e19fd8e94c5415b805f61fd2a07\n", "Successfully built ffmpy pycryptodome python-multipart\n", "Installing collected packages: rfc3986, pydub, ffmpy, websockets, uc-micro-py, python-multipart, pycryptodome, orjson, multidict, mdurl, h11, fsspec, frozenlist, async-timeout, aiofiles, yarl, uvicorn, starlette, markdown-it-py, linkify-it-py, httpcore, aiosignal, mdit-py-plugins, httpx, fastapi, altair, aiohttp, gradio\n", "Successfully installed aiofiles-22.1.0 aiohttp-3.8.3 aiosignal-1.3.1 altair-4.2.0 async-timeout-4.0.2 fastapi-0.89.1 ffmpy-0.3.0 frozenlist-1.3.3 fsspec-2023.1.0 gradio-3.16.2 h11-0.14.0 httpcore-0.16.3 httpx-0.23.3 linkify-it-py-1.0.3 markdown-it-py-2.1.0 mdit-py-plugins-0.3.3 mdurl-0.1.2 multidict-6.0.4 orjson-3.8.5 pycryptodome-3.16.0 pydub-0.25.1 python-multipart-0.0.5 rfc3986-1.5.0 starlette-0.22.0 uc-micro-py-1.0.1 uvicorn-0.20.0 websockets-10.4 yarl-1.8.2\n" ] } ], "source": [ "!pip3 install gradio" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "import fastai" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.10.8" }, "vscode": { "interpreter": { "hash": "4e71138104a91189cd6ffb8e6d7f8b2c2c6cae322a5bed2e5c5a8a57641ad73b" } } }, "nbformat": 4, "nbformat_minor": 2 }