|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 61, |
6 | | - "id": "happy-remedy", |
| 5 | + "execution_count": null, |
| 6 | + "id": "mobile-mailing", |
7 | 7 | "metadata": {}, |
8 | | - "outputs": [ |
9 | | - { |
10 | | - "name": "stdout", |
11 | | - "output_type": "stream", |
12 | | - "text": [ |
13 | | - "Requirement already satisfied: voila in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (0.2.7)\n", |
14 | | - "Requirement already satisfied: nbclient<0.6,>=0.4.0 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from voila) (0.5.2)\n", |
15 | | - "Requirement already satisfied: jupyter-client<7,>=6.1.3 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from voila) (6.1.7)\n", |
16 | | - "Requirement already satisfied: jupyter-server<2.0.0,>=0.3.0 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from voila) (1.4.0)\n", |
17 | | - "Requirement already satisfied: nbconvert<7,>=6.0.0 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from voila) (6.0.7)\n", |
18 | | - "Requirement already satisfied: jupyter-core>=4.6.0 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-client<7,>=6.1.3->voila) (4.7.1)\n", |
19 | | - "Requirement already satisfied: python-dateutil>=2.1 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-client<7,>=6.1.3->voila) (2.8.1)\n", |
20 | | - "Requirement already satisfied: pyzmq>=13 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-client<7,>=6.1.3->voila) (20.0.0)\n", |
21 | | - "Requirement already satisfied: tornado>=4.1 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-client<7,>=6.1.3->voila) (6.1)\n", |
22 | | - "Requirement already satisfied: traitlets in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-client<7,>=6.1.3->voila) (5.0.5)\n", |
23 | | - "Requirement already satisfied: pywin32>=1.0 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-core>=4.6.0->jupyter-client<7,>=6.1.3->voila) (227)\n", |
24 | | - "Requirement already satisfied: nbformat in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (5.1.2)\n", |
25 | | - "Requirement already satisfied: Send2Trash in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (1.5.0)\n", |
26 | | - "Requirement already satisfied: anyio>=2.0.2 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (2.1.0)\n", |
27 | | - "Requirement already satisfied: prometheus-client in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (0.9.0)\n", |
28 | | - "Requirement already satisfied: ipython-genutils in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (0.2.0)\n", |
29 | | - "Requirement already satisfied: jinja2 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (2.11.3)\n", |
30 | | - "Requirement already satisfied: terminado>=0.8.3 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (0.9.2)\n", |
31 | | - "Requirement already satisfied: typing-extensions in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from anyio>=2.0.2->jupyter-server<2.0.0,>=0.3.0->voila) (3.7.4.3)\n", |
32 | | - "Requirement already satisfied: sniffio>=1.1 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from anyio>=2.0.2->jupyter-server<2.0.0,>=0.3.0->voila) (1.2.0)\n", |
33 | | - "Requirement already satisfied: idna>=2.8 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from anyio>=2.0.2->jupyter-server<2.0.0,>=0.3.0->voila) (2.10)\n", |
34 | | - "Requirement already satisfied: async-generator in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbclient<0.6,>=0.4.0->voila) (1.10)\n", |
35 | | - "Requirement already satisfied: nest-asyncio in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbclient<0.6,>=0.4.0->voila) (1.5.1)\n", |
36 | | - "Requirement already satisfied: testpath in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbconvert<7,>=6.0.0->voila) (0.4.4)\n", |
37 | | - "Requirement already satisfied: jupyterlab-pygments in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbconvert<7,>=6.0.0->voila) (0.1.2)\n", |
38 | | - "Requirement already satisfied: bleach in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbconvert<7,>=6.0.0->voila) (3.3.0)\n", |
39 | | - "Requirement already satisfied: entrypoints>=0.2.2 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbconvert<7,>=6.0.0->voila) (0.3)\n", |
40 | | - "Requirement already satisfied: mistune<2,>=0.8.1 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbconvert<7,>=6.0.0->voila) (0.8.4)\n", |
41 | | - "Requirement already satisfied: defusedxml in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbconvert<7,>=6.0.0->voila) (0.6.0)\n", |
42 | | - "Requirement already satisfied: pandocfilters>=1.4.1 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbconvert<7,>=6.0.0->voila) (1.4.3)\n", |
43 | | - "Requirement already satisfied: pygments>=2.4.1 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbconvert<7,>=6.0.0->voila) (2.7.4)\n", |
44 | | - "Requirement already satisfied: MarkupSafe>=0.23 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jinja2->jupyter-server<2.0.0,>=0.3.0->voila) (1.1.1)\n", |
45 | | - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (3.0.2)\n", |
46 | | - "Requirement already satisfied: pyrsistent>=0.14.0 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (0.17.3)\n", |
47 | | - "Requirement already satisfied: setuptools in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (52.0.0.post20210125)\n", |
48 | | - "Requirement already satisfied: six>=1.11.0 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (1.15.0)\n", |
49 | | - "Requirement already satisfied: attrs>=17.4.0 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (20.3.0)\n", |
50 | | - "Requirement already satisfied: pywinpty>=0.5 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from terminado>=0.8.3->jupyter-server<2.0.0,>=0.3.0->voila) (0.5.7)\n", |
51 | | - "Requirement already satisfied: webencodings in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from bleach->nbconvert<7,>=6.0.0->voila) (0.5.1)\n", |
52 | | - "Requirement already satisfied: packaging in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from bleach->nbconvert<7,>=6.0.0->voila) (20.9)\n", |
53 | | - "Requirement already satisfied: pyparsing>=2.0.2 in c:\\users\\victor\\.conda\\envs\\fastai\\lib\\site-packages (from packaging->bleach->nbconvert<7,>=6.0.0->voila) (2.4.7)\n" |
54 | | - ] |
55 | | - }, |
56 | | - { |
57 | | - "name": "stderr", |
58 | | - "output_type": "stream", |
59 | | - "text": [ |
60 | | - "Enabling: voila\n", |
61 | | - "- Writing config: C:\\Users\\Victor\\.conda\\envs\\FastAI\\etc\\jupyter\n", |
62 | | - " - Validating...\n", |
63 | | - " voila 0.2.7 ok\n" |
64 | | - ] |
65 | | - } |
66 | | - ], |
| 8 | + "outputs": [], |
67 | 9 | "source": [ |
| 10 | + "#hide\n", |
| 11 | + "!pip install -Uqq fastbook\n", |
68 | 12 | "!pip install voila\n", |
69 | 13 | "!jupyter serverextension enable --sys-prefix voila\n", |
70 | 14 | "import fastbook\n", |
71 | 15 | "fastbook.setup_book()\n", |
72 | 16 | "from fastbook import *\n", |
73 | | - "from fastai.vision.widgets import *\n", |
74 | | - "from fastai import *" |
| 17 | + "from fastai.vision.widgets import *" |
75 | 18 | ] |
76 | 19 | }, |
77 | 20 | { |
78 | 21 | "cell_type": "code", |
79 | | - "execution_count": 42, |
80 | | - "id": "front-independence", |
| 22 | + "execution_count": 4, |
| 23 | + "id": "specific-connectivity", |
81 | 24 | "metadata": {}, |
82 | | - "outputs": [ |
83 | | - { |
84 | | - "data": { |
85 | | - "text/plain": [ |
86 | | - "<fastai.learner.Learner at 0x25304955b08>" |
87 | | - ] |
88 | | - }, |
89 | | - "execution_count": 42, |
90 | | - "metadata": {}, |
91 | | - "output_type": "execute_result" |
92 | | - } |
93 | | - ], |
| 25 | + "outputs": [], |
94 | 26 | "source": [ |
95 | | - "learn_inf = load_learner('./export.pkl')\n", |
96 | | - "learn_inf" |
| 27 | + "learn_inf = load_learner('export.pkl')" |
97 | 28 | ] |
98 | 29 | }, |
99 | 30 | { |
100 | 31 | "cell_type": "code", |
101 | | - "execution_count": 58, |
102 | | - "id": "potential-poetry", |
| 32 | + "execution_count": null, |
| 33 | + "id": "initial-theater", |
103 | 34 | "metadata": {}, |
104 | | - "outputs": [ |
105 | | - { |
106 | | - "data": { |
107 | | - "application/vnd.jupyter.widget-view+json": { |
108 | | - "model_id": "a46c0541b0f741ebbb725e007329717e", |
109 | | - "version_major": 2, |
110 | | - "version_minor": 0 |
111 | | - }, |
112 | | - "text/plain": [ |
113 | | - "FileUpload(value={}, description='Upload')" |
114 | | - ] |
115 | | - }, |
116 | | - "metadata": {}, |
117 | | - "output_type": "display_data" |
118 | | - } |
119 | | - ], |
| 35 | + "outputs": [], |
120 | 36 | "source": [ |
121 | 37 | "from fastai import *\n", |
122 | 38 | "btn_upload = vision.widgets.FileUpload()\n", |
123 | 39 | "out_pl = vision.widgets.Output()\n", |
124 | 40 | "btn_run = vision.widgets.Button(description='Clasificar')\n", |
125 | 41 | "lbl_prediction_a = widgets.Label()\n", |
126 | | - "lbl_prediction_b = widgets.Label()\n", |
127 | | - "btn_upload" |
| 42 | + "lbl_prediction_b = widgets.Label()" |
128 | 43 | ] |
129 | 44 | }, |
130 | 45 | { |
131 | 46 | "cell_type": "code", |
132 | | - "execution_count": 48, |
133 | | - "id": "infrared-treasury", |
| 47 | + "execution_count": null, |
| 48 | + "id": "invisible-grade", |
134 | 49 | "metadata": {}, |
135 | 50 | "outputs": [], |
136 | 51 | "source": [ |
137 | | - "\n", |
138 | 52 | "def on_click_classify(change):\n", |
139 | 53 | " img = PILImage.create(btn_upload.data[0])\n", |
140 | 54 | " out_pl.clear_output()\n", |
|
151 | 65 | }, |
152 | 66 | { |
153 | 67 | "cell_type": "code", |
154 | | - "execution_count": 50, |
155 | | - "id": "allied-people", |
| 68 | + "execution_count": null, |
| 69 | + "id": "composite-sauce", |
156 | 70 | "metadata": {}, |
157 | | - "outputs": [ |
158 | | - { |
159 | | - "name": "stdout", |
160 | | - "output_type": "stream", |
161 | | - "text": [ |
162 | | - "FileUpload(value={}, description='Upload')\n", |
163 | | - "Button(description='Clasificar', style=ButtonStyle())\n", |
164 | | - "Output()\n", |
165 | | - "Label(value='')\n", |
166 | | - "Label(value='')\n" |
167 | | - ] |
168 | | - }, |
169 | | - { |
170 | | - "data": { |
171 | | - "application/vnd.jupyter.widget-view+json": { |
172 | | - "model_id": "83695b40705242b6803bf11b55dc7355", |
173 | | - "version_major": 2, |
174 | | - "version_minor": 0 |
175 | | - }, |
176 | | - "text/plain": [ |
177 | | - "VBox(children=(Label(value='Selecciona tu cosa'), FileUpload(value={}, description='Upload'), Button(descripti…" |
178 | | - ] |
179 | | - }, |
180 | | - "metadata": {}, |
181 | | - "output_type": "display_data" |
182 | | - } |
183 | | - ], |
| 71 | + "outputs": [], |
184 | 72 | "source": [ |
185 | 73 | "#hide_output\n", |
186 | 74 | "print(btn_upload)\n", |
|
0 commit comments