SmokingBrisket321 commited on
Commit
55f0611
β€’
1 Parent(s): 607208b

fly baby fly

Browse files
Files changed (1) hide show
  1. app.ipynb +176 -153
app.ipynb CHANGED
@@ -2,22 +2,20 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 1,
6
  "metadata": {},
7
- "outputs": [
8
- {
9
- "ename": "ModuleNotFoundError",
10
- "evalue": "No module named 'gradio'",
11
- "output_type": "error",
12
- "traceback": [
13
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
14
- "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
15
- "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",
16
- "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'gradio'"
17
- ]
18
- }
19
- ],
20
  "source": [
 
 
 
 
 
 
 
 
 
 
21
  "#|export\n",
22
  "from fastai.vision.all import *\n",
23
  "import gradio as gr\n",
@@ -27,160 +25,185 @@
27
  },
28
  {
29
  "cell_type": "code",
30
- "execution_count": 7,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  "metadata": {},
32
  "outputs": [
33
  {
34
- "name": "stdout",
35
  "output_type": "stream",
36
  "text": [
37
- "Collecting gradio\n",
38
- " Downloading gradio-3.16.2-py3-none-any.whl (14.2 MB)\n",
39
- "\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",
40
- "\u001b[?25hRequirement already satisfied: markupsafe in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (2.1.2)\n",
41
- "Collecting orjson\n",
42
- " Downloading orjson-3.8.5-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (489 kB)\n",
43
- "\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",
44
- "\u001b[?25hRequirement already satisfied: typing-extensions in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (4.4.0)\n",
45
- "Collecting aiofiles\n",
46
- " Downloading aiofiles-22.1.0-py3-none-any.whl (14 kB)\n",
47
- "Collecting pydub\n",
48
- " Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n",
49
- "Collecting httpx\n",
50
- " Downloading httpx-0.23.3-py3-none-any.whl (71 kB)\n",
51
- "\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",
52
- "\u001b[?25hCollecting pycryptodome\n",
53
- " Downloading pycryptodome-3.16.0.tar.gz (4.5 MB)\n",
54
- "\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",
55
- "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25ldone\n",
56
- "\u001b[?25hRequirement already satisfied: pydantic in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (1.10.4)\n",
57
- "Requirement already satisfied: jinja2 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (3.1.2)\n",
58
- "Requirement already satisfied: requests in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (2.28.2)\n",
59
- "Collecting altair>=4.2.0\n",
60
- " Downloading altair-4.2.0-py3-none-any.whl (812 kB)\n",
61
- "\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",
62
- "\u001b[?25hRequirement already satisfied: matplotlib in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (3.6.3)\n",
63
- "Collecting ffmpy\n",
64
- " Downloading ffmpy-0.3.0.tar.gz (4.8 kB)\n",
65
- " Preparing metadata (setup.py) ... \u001b[?25ldone\n",
66
- "\u001b[?25hRequirement already satisfied: pandas in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (1.5.3)\n",
67
- "Collecting fsspec\n",
68
- " Downloading fsspec-2023.1.0-py3-none-any.whl (143 kB)\n",
69
- "\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",
70
- "\u001b[?25hCollecting uvicorn\n",
71
- " Downloading uvicorn-0.20.0-py3-none-any.whl (56 kB)\n",
72
- "\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",
73
- "\u001b[?25hCollecting aiohttp\n",
74
- " Downloading aiohttp-3.8.3-cp310-cp310-macosx_11_0_arm64.whl (336 kB)\n",
75
- "\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",
76
- "\u001b[?25hCollecting python-multipart\n",
77
- " Downloading python-multipart-0.0.5.tar.gz (32 kB)\n",
78
- " Preparing metadata (setup.py) ... \u001b[?25ldone\n",
79
- "\u001b[?25hRequirement already satisfied: numpy in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (1.24.1)\n",
80
- "Requirement already satisfied: pyyaml in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (6.0)\n",
81
- "Collecting fastapi\n",
82
- " Downloading fastapi-0.89.1-py3-none-any.whl (55 kB)\n",
83
- "\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",
84
- "\u001b[?25hCollecting websockets>=10.0\n",
85
- " Downloading websockets-10.4-cp310-cp310-macosx_11_0_arm64.whl (97 kB)\n",
86
- "\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",
87
- "\u001b[?25hCollecting markdown-it-py[linkify,plugins]\n",
88
- " Downloading markdown_it_py-2.1.0-py3-none-any.whl (84 kB)\n",
89
- "\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",
90
- "\u001b[?25hRequirement already satisfied: pillow in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from gradio) (9.4.0)\n",
91
- "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",
92
- "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",
93
- "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",
94
- "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",
95
- "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",
96
- "Collecting yarl<2.0,>=1.0\n",
97
- " Downloading yarl-1.8.2-cp310-cp310-macosx_11_0_arm64.whl (57 kB)\n",
98
- "\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",
99
- "\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",
100
- "Collecting frozenlist>=1.1.1\n",
101
- " Downloading frozenlist-1.3.3-cp310-cp310-macosx_11_0_arm64.whl (34 kB)\n",
102
- "Collecting multidict<7.0,>=4.5\n",
103
- " Downloading multidict-6.0.4-cp310-cp310-macosx_11_0_arm64.whl (29 kB)\n",
104
- "Collecting aiosignal>=1.1.2\n",
105
- " Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)\n",
106
- "Collecting async-timeout<5.0,>=4.0.0a3\n",
107
- " Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)\n",
108
- "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",
109
- "Collecting starlette==0.22.0\n",
110
- " Downloading starlette-0.22.0-py3-none-any.whl (64 kB)\n",
111
- "\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",
112
- "\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",
113
- "Requirement already satisfied: sniffio in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from httpx->gradio) (1.3.0)\n",
114
- "Requirement already satisfied: certifi in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from httpx->gradio) (2022.12.7)\n",
115
- "Collecting httpcore<0.17.0,>=0.15.0\n",
116
- " Downloading httpcore-0.16.3-py3-none-any.whl (69 kB)\n",
117
- "\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",
118
- "\u001b[?25hCollecting rfc3986[idna2008]<2,>=1.3\n",
119
- " Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)\n",
120
- "Collecting mdurl~=0.1\n",
121
- " Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)\n",
122
- "Collecting linkify-it-py~=1.0\n",
123
- " Downloading linkify_it_py-1.0.3-py3-none-any.whl (19 kB)\n",
124
- "Collecting mdit-py-plugins\n",
125
- " Downloading mdit_py_plugins-0.3.3-py3-none-any.whl (50 kB)\n",
126
- "\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",
127
- "\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",
128
- "Requirement already satisfied: packaging>=20.0 in /Users/christoph.schmitz@schibsted.com/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (23.0)\n",
129
- "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",
130
- "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",
131
- "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",
132
- "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",
133
- "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",
134
- "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",
135
- "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"
136
  ]
137
  },
138
  {
139
  "name": "stdout",
140
  "output_type": "stream",
141
  "text": [
142
- "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",
143
- "Collecting h11>=0.8\n",
144
- " Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n",
145
- "\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",
146
- "\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",
147
- "Collecting uc-micro-py\n",
148
- " Downloading uc_micro_py-1.0.1-py3-none-any.whl (6.2 kB)\n",
149
- "Building wheels for collected packages: ffmpy, pycryptodome, python-multipart\n",
150
- " Building wheel for ffmpy (setup.py) ... \u001b[?25ldone\n",
151
- "\u001b[?25h Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4693 sha256=b13c4d156ac37781713a9351ed85757eb299234a8aeba609bdd283b0b76913d2\n",
152
- " Stored in directory: /Users/christoph.schmitz@schibsted.com/Library/Caches/pip/wheels/fe/17/e9/577da024bc5aede641c69f0675254c1e518db79800abbe135c\n",
153
- " Building wheel for pycryptodome (setup.py) ... \u001b[?25ldone\n",
154
- "\u001b[?25h Created wheel for pycryptodome: filename=pycryptodome-3.16.0-cp35-abi3-macosx_11_0_arm64.whl size=1532741 sha256=cfb1d46136a9e580af55bae62d364564cd319868f62483eda575f09abd8dd6c1\n",
155
- " Stored in directory: /Users/christoph.schmitz@schibsted.com/Library/Caches/pip/wheels/7a/8a/76/6e5de52adfb0dee5462d54b54a610e9b5215c056d6876ce3ce\n",
156
- " Building wheel for python-multipart (setup.py) ... \u001b[?25ldone\n",
157
- "\u001b[?25h Created wheel for python-multipart: filename=python_multipart-0.0.5-py3-none-any.whl size=31670 sha256=705092b4ca635b008df23e58f42871e4acac7ba9b7899e3545afe8ca12995666\n",
158
- " Stored in directory: /Users/christoph.schmitz@schibsted.com/Library/Caches/pip/wheels/1a/70/03/c981b93a16009e0e54f9f16e19fd8e94c5415b805f61fd2a07\n",
159
- "Successfully built ffmpy pycryptodome python-multipart\n",
160
- "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",
161
- "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"
162
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
  ],
165
  "source": [
166
- "!pip3 install gradio"
167
- ]
168
- },
169
- {
170
- "cell_type": "code",
171
- "execution_count": 6,
172
- "metadata": {},
173
- "outputs": [],
174
- "source": [
175
- "import fastai"
176
  ]
177
- },
178
- {
179
- "cell_type": "code",
180
- "execution_count": null,
181
- "metadata": {},
182
- "outputs": [],
183
- "source": []
184
  }
185
  ],
186
  "metadata": {
@@ -199,7 +222,7 @@
199
  "name": "python",
200
  "nbconvert_exporter": "python",
201
  "pygments_lexer": "ipython3",
202
- "version": "3.10.8"
203
  },
204
  "vscode": {
205
  "interpreter": {
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 11,
6
  "metadata": {},
7
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
8
  "source": [
9
+ "#|default_exp app"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "code",
14
+ "execution_count": 12,
15
+ "metadata": {},
16
+ "outputs": [],
17
+ "source": [
18
+ "\n",
19
  "#|export\n",
20
  "from fastai.vision.all import *\n",
21
  "import gradio as gr\n",
 
25
  },
26
  {
27
  "cell_type": "code",
28
+ "execution_count": 16,
29
+ "metadata": {},
30
+ "outputs": [],
31
+ "source": [
32
+ "#|export\n",
33
+ "learn = load_learner('export.pkl')"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "code",
38
+ "execution_count": 17,
39
+ "metadata": {},
40
+ "outputs": [],
41
+ "source": [
42
+ "#|export\n",
43
+ "categories = ('Rambo', 'Rocky')\n",
44
+ "\n",
45
+ "def classify_image(img):\n",
46
+ " pred,idx,probs = learn.predict(img)\n",
47
+ " return dict(zip(categories, map(float,probs)))"
48
+ ]
49
+ },
50
+ {
51
+ "cell_type": "code",
52
+ "execution_count": 18,
53
  "metadata": {},
54
  "outputs": [
55
  {
56
+ "name": "stderr",
57
  "output_type": "stream",
58
  "text": [
59
+ "/Users/christoph.schmitz@schibsted.com/.pyenv/versions/anaconda3-2022.05/lib/python3.9/site-packages/gradio/inputs.py:257: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
60
+ " warnings.warn(\n",
61
+ "/Users/christoph.schmitz@schibsted.com/.pyenv/versions/anaconda3-2022.05/lib/python3.9/site-packages/gradio/deprecation.py:40: UserWarning: `optional` parameter is deprecated, and it has no effect\n",
62
+ " warnings.warn(value)\n",
63
+ "/Users/christoph.schmitz@schibsted.com/.pyenv/versions/anaconda3-2022.05/lib/python3.9/site-packages/gradio/outputs.py:197: UserWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
64
+ " warnings.warn(\n",
65
+ "/Users/christoph.schmitz@schibsted.com/.pyenv/versions/anaconda3-2022.05/lib/python3.9/site-packages/gradio/deprecation.py:40: UserWarning: The 'type' parameter has been deprecated. Use the Number component instead.\n",
66
+ " warnings.warn(value)\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  ]
68
  },
69
  {
70
  "name": "stdout",
71
  "output_type": "stream",
72
  "text": [
73
+ "Running on local URL: http://127.0.0.1:7860\n",
74
+ "\n",
75
+ "To create a public link, set `share=True` in `launch()`.\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  ]
77
+ },
78
+ {
79
+ "data": {
80
+ "text/plain": []
81
+ },
82
+ "execution_count": 18,
83
+ "metadata": {},
84
+ "output_type": "execute_result"
85
+ },
86
+ {
87
+ "data": {
88
+ "text/html": [
89
+ "\n",
90
+ "<style>\n",
91
+ " /* Turns off some styling */\n",
92
+ " progress {\n",
93
+ " /* gets rid of default border in Firefox and Opera. */\n",
94
+ " border: none;\n",
95
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
96
+ " background-size: auto;\n",
97
+ " }\n",
98
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
99
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
100
+ " }\n",
101
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
102
+ " background: #F44336;\n",
103
+ " }\n",
104
+ "</style>\n"
105
+ ],
106
+ "text/plain": [
107
+ "<IPython.core.display.HTML object>"
108
+ ]
109
+ },
110
+ "metadata": {},
111
+ "output_type": "display_data"
112
+ },
113
+ {
114
+ "data": {
115
+ "text/html": [],
116
+ "text/plain": [
117
+ "<IPython.core.display.HTML object>"
118
+ ]
119
+ },
120
+ "metadata": {},
121
+ "output_type": "display_data"
122
+ },
123
+ {
124
+ "data": {
125
+ "text/html": [
126
+ "\n",
127
+ "<style>\n",
128
+ " /* Turns off some styling */\n",
129
+ " progress {\n",
130
+ " /* gets rid of default border in Firefox and Opera. */\n",
131
+ " border: none;\n",
132
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
133
+ " background-size: auto;\n",
134
+ " }\n",
135
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
136
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
137
+ " }\n",
138
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
139
+ " background: #F44336;\n",
140
+ " }\n",
141
+ "</style>\n"
142
+ ],
143
+ "text/plain": [
144
+ "<IPython.core.display.HTML object>"
145
+ ]
146
+ },
147
+ "metadata": {},
148
+ "output_type": "display_data"
149
+ },
150
+ {
151
+ "data": {
152
+ "text/html": [],
153
+ "text/plain": [
154
+ "<IPython.core.display.HTML object>"
155
+ ]
156
+ },
157
+ "metadata": {},
158
+ "output_type": "display_data"
159
+ },
160
+ {
161
+ "data": {
162
+ "text/html": [
163
+ "\n",
164
+ "<style>\n",
165
+ " /* Turns off some styling */\n",
166
+ " progress {\n",
167
+ " /* gets rid of default border in Firefox and Opera. */\n",
168
+ " border: none;\n",
169
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
170
+ " background-size: auto;\n",
171
+ " }\n",
172
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
173
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
174
+ " }\n",
175
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
176
+ " background: #F44336;\n",
177
+ " }\n",
178
+ "</style>\n"
179
+ ],
180
+ "text/plain": [
181
+ "<IPython.core.display.HTML object>"
182
+ ]
183
+ },
184
+ "metadata": {},
185
+ "output_type": "display_data"
186
+ },
187
+ {
188
+ "data": {
189
+ "text/html": [],
190
+ "text/plain": [
191
+ "<IPython.core.display.HTML object>"
192
+ ]
193
+ },
194
+ "metadata": {},
195
+ "output_type": "display_data"
196
  }
197
  ],
198
  "source": [
199
+ "#|export\n",
200
+ "image = gr.inputs.Image(shape=(192, 192))\n",
201
+ "label = gr.outputs.Label()\n",
202
+ "examples = ['rocky.png', 'rambo.png']\n",
203
+ "\n",
204
+ "intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)\n",
205
+ "intf.launch(inline=False)"
 
 
 
206
  ]
 
 
 
 
 
 
 
207
  }
208
  ],
209
  "metadata": {
 
222
  "name": "python",
223
  "nbconvert_exporter": "python",
224
  "pygments_lexer": "ipython3",
225
+ "version": "3.9.12"
226
  },
227
  "vscode": {
228
  "interpreter": {