FawadHaider2 commited on
Commit
06b75d7
·
verified ·
1 Parent(s): 7cce68a

Upload 12 files

Browse files
Files changed (12) hide show
  1. Benign 1.jpg +0 -0
  2. Benign 2.jpg +0 -0
  3. Benign 3.jpg +0 -0
  4. DS_Store +0 -0
  5. Malignant 1.jpg +0 -0
  6. Malignant 2.jpg +0 -0
  7. Malignant 3.jpg +0 -0
  8. README.md +5 -4
  9. app.ipynb +686 -0
  10. app.py +19 -0
  11. export.pkl +3 -0
  12. requirements.txt +2 -0
Benign 1.jpg ADDED
Benign 2.jpg ADDED
Benign 3.jpg ADDED
DS_Store ADDED
Binary file (6.15 kB). View file
 
Malignant 1.jpg ADDED
Malignant 2.jpg ADDED
Malignant 3.jpg ADDED
README.md CHANGED
@@ -1,12 +1,13 @@
1
  ---
2
- title: SKIN CANCER DETECTION
3
- emoji: 🌍
4
  colorFrom: red
5
- colorTo: indigo
6
  sdk: gradio
7
- sdk_version: 5.8.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Skin Cancer Detection
3
+ emoji: 🐢
4
  colorFrom: red
5
+ colorTo: blue
6
  sdk: gradio
7
+ sdk_version: 3.32.0
8
  app_file: app.py
9
  pinned: false
10
+ license: apache-2.0
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.ipynb ADDED
@@ -0,0 +1,686 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "Defaulting to user installation because normal site-packages is not writeable\n",
13
+ "Collecting fastai\n",
14
+ " Using cached fastai-2.7.12-py3-none-any.whl (233 kB)\n",
15
+ "Collecting matplotlib\n",
16
+ " Downloading matplotlib-3.7.1-cp39-cp39-macosx_10_12_x86_64.whl (7.4 MB)\n",
17
+ "\u001b[K |████████████████████████████████| 7.4 MB 341 kB/s eta 0:00:01 |▏ | 51 kB 835 kB/s eta 0:00:09\n",
18
+ "\u001b[?25hCollecting torchvision>=0.8.2\n",
19
+ " Downloading torchvision-0.15.2-cp39-cp39-macosx_10_9_x86_64.whl (1.5 MB)\n",
20
+ "\u001b[K |████████████████████████████████| 1.5 MB 3.7 MB/s eta 0:00:01 |█▎ | 61 kB 3.0 MB/s eta 0:00:01 |████▉ | 225 kB 3.7 MB/s eta 0:00:01\n",
21
+ "\u001b[?25hCollecting scipy\n",
22
+ " Downloading scipy-1.10.1-cp39-cp39-macosx_10_9_x86_64.whl (35.2 MB)\n",
23
+ "\u001b[K |████████████████████████████████| 35.2 MB 116 kB/s eta 0:00:011 |██████████ | 11.1 MB 27.8 MB/s eta 0:00:01 |█████████████▎ | 14.5 MB 27.8 MB/s eta 0:00:01 |█████████████████████▏ | 23.3 MB 5.8 MB/s eta 0:00:03\n",
24
+ "\u001b[?25hCollecting pyyaml\n",
25
+ " Downloading PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl (197 kB)\n",
26
+ "\u001b[K |████████████████████████████████| 197 kB 2.7 MB/s eta 0:00:0101\n",
27
+ "\u001b[?25hCollecting fastdownload<2,>=0.0.5\n",
28
+ " Using cached fastdownload-0.0.7-py3-none-any.whl (12 kB)\n",
29
+ "Requirement already satisfied: packaging in /Users/alex/Library/Python/3.9/lib/python/site-packages (from fastai) (23.1)\n",
30
+ "Collecting pandas\n",
31
+ " Downloading pandas-2.0.2-cp39-cp39-macosx_10_9_x86_64.whl (11.8 MB)\n",
32
+ "\u001b[K |████████████████████████████████| 11.8 MB 18.7 MB/s eta 0:00:01 |█▌ | 552 kB 5.8 MB/s eta 0:00:02:00:02███████▍ | 11.2 MB 18.7 MB/s eta 0:00:01\n",
33
+ "\u001b[?25hCollecting fastprogress>=0.2.4\n",
34
+ " Using cached fastprogress-1.0.3-py3-none-any.whl (12 kB)\n",
35
+ "Collecting spacy<4\n",
36
+ " Downloading spacy-3.5.3-cp39-cp39-macosx_10_9_x86_64.whl (6.9 MB)\n",
37
+ "\u001b[K |████████████████████████████████| 6.9 MB 2.0 MB/s eta 0:00:01 |▌ | 102 kB 2.0 MB/s eta 0:00:04\n",
38
+ "\u001b[?25hCollecting torch<2.1,>=1.7\n",
39
+ " Downloading torch-2.0.1-cp39-none-macosx_10_9_x86_64.whl (143.4 MB)\n",
40
+ "\u001b[K |████████████████████████████████| 143.4 MB 61 kB/s s eta 0:00:01 | | 61 kB 448 kB/s eta 0:05:20 |████ | 17.6 MB 25.1 MB/s eta 0:00:06 |█████████▎ | 41.5 MB 47.9 MB/s eta 0:00:03 |██████████▋ | 47.7 MB 47.9 MB/s eta 0:00:02 |███████████▎ | 50.7 MB 2.5 MB/s eta 0:00:38 |███████████▍ | 50.9 MB 2.5 MB/s eta 0:00:37 |███████████▊ | 52.4 MB 2.5 MB/s eta 0:00:37 |██████████████▊ | 66.0 MB 383 kB/s eta 0:03:22 |█████████████████ | 76.2 MB 5.4 MB/s eta 0:00:13███▋ | 78.8 MB 9.4 MB/s eta 0:00:07 |██████████████████▍ | 82.3 MB 3.8 MB/s eta 0:00:17██████████▊ | 83.7 MB 3.8 MB/s eta 0:00:16 |███████████████████████▉ | 106.9 MB 793 kB/s eta 0:00:47 |██████████████████████████▉ | 120.1 MB 4.7 MB/s eta 0:00:06 0:00:05 |████████████████████████████ | 125.8 MB 4.7 MB/s eta 0:00:04 |█████████████████████████████ | 130.4 MB 5.0 MB/s eta 0:00:03\n",
41
+ "\u001b[?25hCollecting fastcore<1.6,>=1.5.29\n",
42
+ " Using cached fastcore-1.5.29-py3-none-any.whl (67 kB)\n",
43
+ "Collecting requests\n",
44
+ " Using cached requests-2.31.0-py3-none-any.whl (62 kB)\n",
45
+ "Collecting scikit-learn\n",
46
+ " Downloading scikit_learn-1.2.2-cp39-cp39-macosx_10_9_x86_64.whl (9.1 MB)\n",
47
+ "\u001b[K |████████████████████████████████| 9.1 MB 740 kB/s eta 0:00:01\n",
48
+ "\u001b[?25hRequirement already satisfied: pip in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from fastai) (21.2.4)\n",
49
+ "Collecting pillow>6.0.0\n",
50
+ " Downloading Pillow-9.5.0-cp39-cp39-macosx_10_10_x86_64.whl (3.4 MB)\n",
51
+ "\u001b[K |████████████████████████████████| 3.4 MB 4.5 MB/s eta 0:00:01 |██▌ | 266 kB 4.5 MB/s eta 0:00:01\n",
52
+ "\u001b[?25hCollecting srsly<3.0.0,>=2.4.3\n",
53
+ " Downloading srsly-2.4.6-cp39-cp39-macosx_10_9_x86_64.whl (492 kB)\n",
54
+ "\u001b[K |████████████████████████████████| 492 kB 3.5 MB/s eta 0:00:01\n",
55
+ "\u001b[?25hCollecting murmurhash<1.1.0,>=0.28.0\n",
56
+ " Downloading murmurhash-1.0.9-cp39-cp39-macosx_10_9_x86_64.whl (18 kB)\n",
57
+ "Collecting preshed<3.1.0,>=3.0.2\n",
58
+ " Downloading preshed-3.0.8-cp39-cp39-macosx_10_9_x86_64.whl (107 kB)\n",
59
+ "\u001b[K |████████████████████████████████| 107 kB 5.0 MB/s eta 0:00:01\n",
60
+ "\u001b[?25hCollecting langcodes<4.0.0,>=3.2.0\n",
61
+ " Using cached langcodes-3.3.0-py3-none-any.whl (181 kB)\n",
62
+ "Requirement already satisfied: setuptools in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from spacy<4->fastai) (58.0.4)\n",
63
+ "Collecting spacy-loggers<2.0.0,>=1.0.0\n",
64
+ " Using cached spacy_loggers-1.0.4-py3-none-any.whl (11 kB)\n",
65
+ "Collecting thinc<8.2.0,>=8.1.8\n",
66
+ " Downloading thinc-8.1.10-cp39-cp39-macosx_10_9_x86_64.whl (867 kB)\n",
67
+ "\u001b[K |████████████████████████████████| 867 kB 5.8 MB/s eta 0:00:01\n",
68
+ "\u001b[?25hCollecting pathy>=0.10.0\n",
69
+ " Using cached pathy-0.10.1-py3-none-any.whl (48 kB)\n",
70
+ "Collecting catalogue<2.1.0,>=2.0.6\n",
71
+ " Using cached catalogue-2.0.8-py3-none-any.whl (17 kB)\n",
72
+ "Collecting numpy>=1.15.0\n",
73
+ " Downloading numpy-1.24.3-cp39-cp39-macosx_10_9_x86_64.whl (19.8 MB)\n",
74
+ "\u001b[K |████████████████████████████████| 19.8 MB 98 kB/s eta 0:00:01 |▉ | 532 kB 3.4 MB/s eta 0:00:06 |████████████████████▎ | 12.5 MB 7.6 MB/s eta 0:00:01\n",
75
+ "\u001b[?25hCollecting spacy-legacy<3.1.0,>=3.0.11\n",
76
+ " Using cached spacy_legacy-3.0.12-py2.py3-none-any.whl (29 kB)\n",
77
+ "Collecting jinja2\n",
78
+ " Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)\n",
79
+ "Collecting typer<0.8.0,>=0.3.0\n",
80
+ " Using cached typer-0.7.0-py3-none-any.whl (38 kB)\n",
81
+ "Collecting tqdm<5.0.0,>=4.38.0\n",
82
+ " Using cached tqdm-4.65.0-py3-none-any.whl (77 kB)\n",
83
+ "Collecting cymem<2.1.0,>=2.0.2\n",
84
+ " Downloading cymem-2.0.7-cp39-cp39-macosx_10_9_x86_64.whl (32 kB)\n",
85
+ "Collecting pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4\n",
86
+ " Downloading pydantic-1.10.8-cp39-cp39-macosx_10_9_x86_64.whl (2.9 MB)\n",
87
+ "\u001b[K |████████████████████████████████| 2.9 MB 2.3 MB/s eta 0:00:01\n",
88
+ "\u001b[?25hCollecting smart-open<7.0.0,>=5.2.1\n",
89
+ " Using cached smart_open-6.3.0-py3-none-any.whl (56 kB)\n",
90
+ "Collecting wasabi<1.2.0,>=0.9.1\n",
91
+ " Using cached wasabi-1.1.1-py3-none-any.whl (27 kB)\n",
92
+ "Requirement already satisfied: typing-extensions>=4.2.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4->spacy<4->fastai) (4.6.3)\n",
93
+ "Collecting urllib3<3,>=1.21.1\n",
94
+ " Using cached urllib3-2.0.2-py3-none-any.whl (123 kB)\n",
95
+ "Collecting charset-normalizer<4,>=2\n",
96
+ " Downloading charset_normalizer-3.1.0-cp39-cp39-macosx_10_9_x86_64.whl (124 kB)\n",
97
+ "\u001b[K |████████████████████████████████| 124 kB 3.6 MB/s eta 0:00:01\n",
98
+ "\u001b[?25hCollecting certifi>=2017.4.17\n",
99
+ " Using cached certifi-2023.5.7-py3-none-any.whl (156 kB)\n",
100
+ "Collecting idna<4,>=2.5\n",
101
+ " Using cached idna-3.4-py3-none-any.whl (61 kB)\n",
102
+ "Collecting confection<1.0.0,>=0.0.1\n",
103
+ " Using cached confection-0.0.4-py3-none-any.whl (32 kB)\n",
104
+ "Collecting blis<0.8.0,>=0.7.8\n",
105
+ " Downloading blis-0.7.9-cp39-cp39-macosx_10_9_x86_64.whl (6.1 MB)\n",
106
+ "\u001b[K |████████████████████████████████| 6.1 MB 5.0 MB/s eta 0:00:01\n",
107
+ "\u001b[?25hCollecting networkx\n",
108
+ " Downloading networkx-3.1-py3-none-any.whl (2.1 MB)\n",
109
+ "\u001b[K |████████████████████████████████| 2.1 MB 4.0 MB/s eta 0:00:01 |███████████▉ | 768 kB 4.0 MB/s eta 0:00:01\n",
110
+ "\u001b[?25hCollecting sympy\n",
111
+ " Downloading sympy-1.12-py3-none-any.whl (5.7 MB)\n",
112
+ "\u001b[K |████████████████████████████████| 5.7 MB 2.3 MB/s eta 0:00:01\n",
113
+ "\u001b[?25hCollecting filelock\n",
114
+ " Using cached filelock-3.12.0-py3-none-any.whl (10 kB)\n",
115
+ "Collecting click<9.0.0,>=7.1.1\n",
116
+ " Using cached click-8.1.3-py3-none-any.whl (96 kB)\n",
117
+ "Collecting MarkupSafe>=2.0\n",
118
+ " Downloading MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_x86_64.whl (13 kB)\n",
119
+ "Collecting fonttools>=4.22.0\n",
120
+ " Downloading fonttools-4.39.4-py3-none-any.whl (1.0 MB)\n",
121
+ "\u001b[K |████████████████████████████████| 1.0 MB 9.4 MB/s eta 0:00:01 |███████████████████████▋ | 747 kB 9.4 MB/s eta 0:00:01\n",
122
+ "\u001b[?25hRequirement already satisfied: python-dateutil>=2.7 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from matplotlib->fastai) (2.8.2)\n",
123
+ "Collecting importlib-resources>=3.2.0\n",
124
+ " Using cached importlib_resources-5.12.0-py3-none-any.whl (36 kB)\n",
125
+ "Collecting cycler>=0.10\n",
126
+ " Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)\n",
127
+ "Collecting pyparsing>=2.3.1\n",
128
+ " Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)\n",
129
+ "Collecting contourpy>=1.0.1\n",
130
+ " Downloading contourpy-1.0.7-cp39-cp39-macosx_10_9_x86_64.whl (244 kB)\n",
131
+ "\u001b[K |████████████████████████████████| 244 kB 2.6 MB/s eta 0:00:01\n",
132
+ "\u001b[?25hCollecting kiwisolver>=1.0.1\n",
133
+ " Downloading kiwisolver-1.4.4-cp39-cp39-macosx_10_9_x86_64.whl (65 kB)\n",
134
+ "\u001b[K |████████████████████████████████| 65 kB 7.9 MB/s eta 0:00:01\n",
135
+ "\u001b[?25hRequirement already satisfied: zipp>=3.1.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from importlib-resources>=3.2.0->matplotlib->fastai) (3.15.0)\n",
136
+ "Requirement already satisfied: six>=1.5 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib->fastai) (1.15.0)\n",
137
+ "Collecting pytz>=2020.1\n",
138
+ " Using cached pytz-2023.3-py2.py3-none-any.whl (502 kB)\n",
139
+ "Collecting tzdata>=2022.1\n",
140
+ " Downloading tzdata-2023.3-py2.py3-none-any.whl (341 kB)\n",
141
+ "\u001b[K |████████████████████████████████| 341 kB 6.3 MB/s eta 0:00:01\n",
142
+ "\u001b[?25hCollecting threadpoolctl>=2.0.0\n",
143
+ " Using cached threadpoolctl-3.1.0-py3-none-any.whl (14 kB)\n",
144
+ "Collecting joblib>=1.1.1\n",
145
+ " Using cached joblib-1.2.0-py3-none-any.whl (297 kB)\n",
146
+ "Collecting mpmath>=0.19\n",
147
+ " Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)\n",
148
+ "\u001b[K |████████████████████████████████| 536 kB 3.4 MB/s eta 0:00:01\n",
149
+ "\u001b[?25hInstalling collected packages: catalogue, srsly, pydantic, numpy, murmurhash, mpmath, MarkupSafe, cymem, click, wasabi, urllib3, typer, sympy, smart-open, preshed, networkx, jinja2, idna, filelock, confection, charset-normalizer, certifi, blis, tzdata, tqdm, torch, threadpoolctl, thinc, spacy-loggers, spacy-legacy, scipy, requests, pytz, pyparsing, pillow, pathy, langcodes, kiwisolver, joblib, importlib-resources, fonttools, fastprogress, fastcore, cycler, contourpy, torchvision, spacy, scikit-learn, pyyaml, pandas, matplotlib, fastdownload, fastai\n",
150
+ "Successfully installed MarkupSafe-2.1.3 blis-0.7.9 catalogue-2.0.8 certifi-2023.5.7 charset-normalizer-3.1.0 click-8.1.3 confection-0.0.4 contourpy-1.0.7 cycler-0.11.0 cymem-2.0.7 fastai-2.7.12 fastcore-1.5.29 fastdownload-0.0.7 fastprogress-1.0.3 filelock-3.12.0 fonttools-4.39.4 idna-3.4 importlib-resources-5.12.0 jinja2-3.1.2 joblib-1.2.0 kiwisolver-1.4.4 langcodes-3.3.0 matplotlib-3.7.1 mpmath-1.3.0 murmurhash-1.0.9 networkx-3.1 numpy-1.24.3 pandas-2.0.2 pathy-0.10.1 pillow-9.5.0 preshed-3.0.8 pydantic-1.10.8 pyparsing-3.0.9 pytz-2023.3 pyyaml-6.0 requests-2.31.0 scikit-learn-1.2.2 scipy-1.10.1 smart-open-6.3.0 spacy-3.5.3 spacy-legacy-3.0.12 spacy-loggers-1.0.4 srsly-2.4.6 sympy-1.12 thinc-8.1.10 threadpoolctl-3.1.0 torch-2.0.1 torchvision-0.15.2 tqdm-4.65.0 typer-0.7.0 tzdata-2023.3 urllib3-2.0.2 wasabi-1.1.1\n",
151
+ "\u001b[33mWARNING: You are using pip version 21.2.4; however, version 23.1.2 is available.\n",
152
+ "You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.\u001b[0m\n",
153
+ "Note: you may need to restart the kernel to use updated packages.\n",
154
+ "Defaulting to user installation because normal site-packages is not writeable\n",
155
+ "Collecting gradio\n",
156
+ " Using cached gradio-3.33.1-py3-none-any.whl (20.0 MB)\n",
157
+ "Collecting mdit-py-plugins<=0.3.3\n",
158
+ " Using cached mdit_py_plugins-0.3.3-py3-none-any.whl (50 kB)\n",
159
+ "Collecting altair>=4.2.0\n",
160
+ " Using cached altair-5.0.1-py3-none-any.whl (471 kB)\n",
161
+ "Collecting huggingface-hub>=0.14.0\n",
162
+ " Using cached huggingface_hub-0.15.1-py3-none-any.whl (236 kB)\n",
163
+ "Collecting fastapi\n",
164
+ " Downloading fastapi-0.96.0-py3-none-any.whl (57 kB)\n",
165
+ "\u001b[K |████████████████████████████████| 57 kB 1.4 MB/s eta 0:00:01\n",
166
+ "\u001b[?25hRequirement already satisfied: typing-extensions in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (4.6.3)\n",
167
+ "Collecting orjson\n",
168
+ " Downloading orjson-3.9.0-cp39-cp39-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl (240 kB)\n",
169
+ "\u001b[K |████████████████████████████████| 240 kB 685 kB/s eta 0:00:01 |█████▌ | 40 kB 476 kB/s eta 0:00:01\n",
170
+ "\u001b[?25hCollecting httpx\n",
171
+ " Using cached httpx-0.24.1-py3-none-any.whl (75 kB)\n",
172
+ "Requirement already satisfied: pygments>=2.12.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (2.15.1)\n",
173
+ "Requirement already satisfied: matplotlib in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (3.7.1)\n",
174
+ "Collecting semantic-version\n",
175
+ " Using cached semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)\n",
176
+ "Collecting python-multipart\n",
177
+ " Using cached python_multipart-0.0.6-py3-none-any.whl (45 kB)\n",
178
+ "Collecting aiohttp\n",
179
+ " Downloading aiohttp-3.8.4-cp39-cp39-macosx_10_9_x86_64.whl (360 kB)\n",
180
+ "\u001b[K |████████████████████████████████| 360 kB 5.4 MB/s eta 0:00:01\n",
181
+ "\u001b[?25hCollecting uvicorn>=0.14.0\n",
182
+ " Using cached uvicorn-0.22.0-py3-none-any.whl (58 kB)\n",
183
+ "Collecting ffmpy\n",
184
+ " Using cached ffmpy-0.3.0.tar.gz (4.8 kB)\n",
185
+ "Requirement already satisfied: jinja2 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (3.1.2)\n",
186
+ "Collecting websockets>=10.0\n",
187
+ " Downloading websockets-11.0.3-cp39-cp39-macosx_10_9_x86_64.whl (120 kB)\n",
188
+ "\u001b[K |████████████████████████████████| 120 kB 7.7 MB/s eta 0:00:01\n",
189
+ "\u001b[?25hCollecting pydub\n",
190
+ " Using cached pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n",
191
+ "Collecting gradio-client>=0.2.4\n",
192
+ " Using cached gradio_client-0.2.5-py3-none-any.whl (288 kB)\n",
193
+ "Requirement already satisfied: markupsafe in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (2.1.3)\n",
194
+ "Collecting markdown-it-py[linkify]>=2.0.0\n",
195
+ " Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)\n",
196
+ "\u001b[K |████████████████████████████████| 87 kB 454 kB/s eta 0:00:011 |███████▌ | 20 kB 4.2 MB/s eta 0:00:01\n",
197
+ "\u001b[?25hRequirement already satisfied: pyyaml in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (6.0)\n",
198
+ "Requirement already satisfied: pydantic in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (1.10.8)\n",
199
+ "Requirement already satisfied: pandas in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (2.0.2)\n",
200
+ "Collecting aiofiles\n",
201
+ " Using cached aiofiles-23.1.0-py3-none-any.whl (14 kB)\n",
202
+ "Requirement already satisfied: pillow in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (9.5.0)\n",
203
+ "Requirement already satisfied: requests in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (2.31.0)\n",
204
+ "Requirement already satisfied: numpy in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio) (1.24.3)\n",
205
+ "Collecting jsonschema>=3.0\n",
206
+ " Using cached jsonschema-4.17.3-py3-none-any.whl (90 kB)\n",
207
+ "Collecting toolz\n",
208
+ " Using cached toolz-0.12.0-py3-none-any.whl (55 kB)\n",
209
+ "Requirement already satisfied: packaging in /Users/alex/Library/Python/3.9/lib/python/site-packages (from gradio-client>=0.2.4->gradio) (23.1)\n",
210
+ "Collecting fsspec\n",
211
+ " Downloading fsspec-2023.5.0-py3-none-any.whl (160 kB)\n",
212
+ "\u001b[K |████████████████████████████████| 160 kB 26.7 MB/s eta 0:00:01\n",
213
+ "\u001b[?25hRequirement already satisfied: tqdm>=4.42.1 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from huggingface-hub>=0.14.0->gradio) (4.65.0)\n",
214
+ "Requirement already satisfied: filelock in /Users/alex/Library/Python/3.9/lib/python/site-packages (from huggingface-hub>=0.14.0->gradio) (3.12.0)\n",
215
+ "Collecting attrs>=17.4.0\n",
216
+ " Using cached attrs-23.1.0-py3-none-any.whl (61 kB)\n",
217
+ "Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0\n",
218
+ " Downloading pyrsistent-0.19.3-cp39-cp39-macosx_10_9_universal2.whl (82 kB)\n",
219
+ "\u001b[K |████████████████████████████████| 82 kB 758 kB/s eta 0:00:01\n",
220
+ "\u001b[?25hCollecting mdurl~=0.1\n",
221
+ " Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)\n",
222
+ "Collecting linkify-it-py<3,>=1\n",
223
+ " Using cached linkify_it_py-2.0.2-py3-none-any.whl (19 kB)\n",
224
+ "Collecting uc-micro-py\n",
225
+ " Using cached uc_micro_py-1.0.2-py3-none-any.whl (6.2 kB)\n",
226
+ "Collecting mdit-py-plugins<=0.3.3\n",
227
+ " Downloading mdit_py_plugins-0.3.2-py3-none-any.whl (50 kB)\n",
228
+ "\u001b[K |████████████████████████████████| 50 kB 3.5 MB/s eta 0:00:011\n",
229
+ "\u001b[?25h Downloading mdit_py_plugins-0.3.1-py3-none-any.whl (46 kB)\n",
230
+ "\u001b[K |████████████████████████████████| 46 kB 7.6 MB/s eta 0:00:01\n",
231
+ "\u001b[?25h Downloading mdit_py_plugins-0.3.0-py3-none-any.whl (43 kB)\n",
232
+ "\u001b[K |████████████████████████████████| 43 kB 1.2 MB/s eta 0:00:01\n",
233
+ "\u001b[?25h Downloading mdit_py_plugins-0.2.8-py3-none-any.whl (41 kB)\n",
234
+ "\u001b[K |████████████████████████████████| 41 kB 43 kB/s eta 0:00:01\n",
235
+ "\u001b[?25h Downloading mdit_py_plugins-0.2.7-py3-none-any.whl (41 kB)\n",
236
+ "\u001b[K |████████████████████████████████| 41 kB 31 kB/s eta 0:00:01\n",
237
+ "\u001b[?25h Downloading mdit_py_plugins-0.2.6-py3-none-any.whl (39 kB)\n",
238
+ " Downloading mdit_py_plugins-0.2.5-py3-none-any.whl (39 kB)\n",
239
+ " Downloading mdit_py_plugins-0.2.4-py3-none-any.whl (39 kB)\n",
240
+ " Downloading mdit_py_plugins-0.2.3-py3-none-any.whl (39 kB)\n",
241
+ " Downloading mdit_py_plugins-0.2.2-py3-none-any.whl (39 kB)\n",
242
+ " Downloading mdit_py_plugins-0.2.1-py3-none-any.whl (38 kB)\n",
243
+ " Downloading mdit_py_plugins-0.2.0-py3-none-any.whl (38 kB)\n",
244
+ " Downloading mdit_py_plugins-0.1.0-py3-none-any.whl (37 kB)\n",
245
+ "INFO: pip is looking at multiple versions of linkify-it-py to determine which version is compatible with other requirements. This could take a while.\n",
246
+ "Collecting linkify-it-py<3,>=1\n",
247
+ " Downloading linkify_it_py-2.0.1-py3-none-any.whl (19 kB)\n",
248
+ " Downloading linkify_it_py-2.0.0-py3-none-any.whl (19 kB)\n",
249
+ " Downloading linkify_it_py-1.0.3-py3-none-any.whl (19 kB)\n",
250
+ " Downloading linkify_it_py-1.0.2-py3-none-any.whl (19 kB)\n",
251
+ " Downloading linkify_it_py-1.0.1-py3-none-any.whl (19 kB)\n",
252
+ " Downloading linkify_it_py-1.0.0-py3-none-any.whl (19 kB)\n",
253
+ "INFO: pip is looking at multiple versions of markdown-it-py[linkify] to determine which version is compatible with other requirements. This could take a while.\n",
254
+ "Collecting markdown-it-py[linkify]>=2.0.0\n",
255
+ " Using cached markdown_it_py-2.2.0-py3-none-any.whl (84 kB)\n",
256
+ "Requirement already satisfied: pytz>=2020.1 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from pandas->gradio) (2023.3)\n",
257
+ "Requirement already satisfied: tzdata>=2022.1 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from pandas->gradio) (2023.3)\n",
258
+ "Requirement already satisfied: python-dateutil>=2.8.2 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from pandas->gradio) (2.8.2)\n",
259
+ "Requirement already satisfied: six>=1.5 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas->gradio) (1.15.0)\n",
260
+ "Requirement already satisfied: click>=7.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from uvicorn>=0.14.0->gradio) (8.1.3)\n",
261
+ "Collecting h11>=0.8\n",
262
+ " Using cached h11-0.14.0-py3-none-any.whl (58 kB)\n",
263
+ "Collecting yarl<2.0,>=1.0\n",
264
+ " Downloading yarl-1.9.2-cp39-cp39-macosx_10_9_x86_64.whl (65 kB)\n",
265
+ "\u001b[K |████████████████████████████████| 65 kB 1.3 MB/s eta 0:00:01\n",
266
+ "\u001b[?25hCollecting async-timeout<5.0,>=4.0.0a3\n",
267
+ " Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)\n",
268
+ "Collecting aiosignal>=1.1.2\n",
269
+ " Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)\n",
270
+ "Collecting frozenlist>=1.1.1\n",
271
+ " Downloading frozenlist-1.3.3-cp39-cp39-macosx_10_9_x86_64.whl (36 kB)\n",
272
+ "Collecting multidict<7.0,>=4.5\n",
273
+ " Downloading multidict-6.0.4-cp39-cp39-macosx_10_9_x86_64.whl (29 kB)\n",
274
+ "Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from aiohttp->gradio) (3.1.0)\n",
275
+ "Requirement already satisfied: idna>=2.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from yarl<2.0,>=1.0->aiohttp->gradio) (3.4)\n",
276
+ "Collecting starlette<0.28.0,>=0.27.0\n",
277
+ " Using cached starlette-0.27.0-py3-none-any.whl (66 kB)\n",
278
+ "Collecting anyio<5,>=3.4.0\n",
279
+ " Using cached anyio-3.7.0-py3-none-any.whl (80 kB)\n",
280
+ "Collecting exceptiongroup\n",
281
+ " Using cached exceptiongroup-1.1.1-py3-none-any.whl (14 kB)\n",
282
+ "Collecting sniffio>=1.1\n",
283
+ " Using cached sniffio-1.3.0-py3-none-any.whl (10 kB)\n",
284
+ "Requirement already satisfied: certifi in /Users/alex/Library/Python/3.9/lib/python/site-packages (from httpx->gradio) (2023.5.7)\n",
285
+ "Collecting httpcore<0.18.0,>=0.15.0\n",
286
+ " Using cached httpcore-0.17.2-py3-none-any.whl (72 kB)\n",
287
+ "Requirement already satisfied: pyparsing>=2.3.1 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from matplotlib->gradio) (3.0.9)\n",
288
+ "Requirement already satisfied: fonttools>=4.22.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from matplotlib->gradio) (4.39.4)\n",
289
+ "Requirement already satisfied: cycler>=0.10 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from matplotlib->gradio) (0.11.0)\n",
290
+ "Requirement already satisfied: importlib-resources>=3.2.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from matplotlib->gradio) (5.12.0)\n",
291
+ "Requirement already satisfied: contourpy>=1.0.1 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from matplotlib->gradio) (1.0.7)\n",
292
+ "Requirement already satisfied: kiwisolver>=1.0.1 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from matplotlib->gradio) (1.4.4)\n",
293
+ "Requirement already satisfied: zipp>=3.1.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from importlib-resources>=3.2.0->matplotlib->gradio) (3.15.0)\n",
294
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from requests->gradio) (2.0.2)\n",
295
+ "Building wheels for collected packages: ffmpy\n",
296
+ " Building wheel for ffmpy (setup.py) ... \u001b[?25ldone\n",
297
+ "\u001b[?25h Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4710 sha256=c063c529e7b3bfa39c8d478191004af3277823163a4494913ee6e001833e6aba\n",
298
+ " Stored in directory: /Users/alex/Library/Caches/pip/wheels/91/e2/96/f676aa08bfd789328c6576cd0f1fde4a3d686703bb0c247697\n",
299
+ "Successfully built ffmpy\n",
300
+ "Installing collected packages: sniffio, exceptiongroup, h11, anyio, uc-micro-py, pyrsistent, multidict, mdurl, httpcore, fsspec, frozenlist, attrs, yarl, websockets, toolz, starlette, markdown-it-py, linkify-it-py, jsonschema, huggingface-hub, httpx, async-timeout, aiosignal, uvicorn, semantic-version, python-multipart, pydub, orjson, mdit-py-plugins, gradio-client, ffmpy, fastapi, altair, aiohttp, aiofiles, gradio\n",
301
+ "Successfully installed aiofiles-23.1.0 aiohttp-3.8.4 aiosignal-1.3.1 altair-5.0.1 anyio-3.7.0 async-timeout-4.0.2 attrs-23.1.0 exceptiongroup-1.1.1 fastapi-0.96.0 ffmpy-0.3.0 frozenlist-1.3.3 fsspec-2023.5.0 gradio-3.33.1 gradio-client-0.2.5 h11-0.14.0 httpcore-0.17.2 httpx-0.24.1 huggingface-hub-0.15.1 jsonschema-4.17.3 linkify-it-py-2.0.2 markdown-it-py-2.2.0 mdit-py-plugins-0.3.3 mdurl-0.1.2 multidict-6.0.4 orjson-3.9.0 pydub-0.25.1 pyrsistent-0.19.3 python-multipart-0.0.6 semantic-version-2.10.0 sniffio-1.3.0 starlette-0.27.0 toolz-0.12.0 uc-micro-py-1.0.2 uvicorn-0.22.0 websockets-11.0.3 yarl-1.9.2\n",
302
+ "\u001b[33mWARNING: You are using pip version 21.2.4; however, version 23.1.2 is available.\n",
303
+ "You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.\u001b[0m\n",
304
+ "Note: you may need to restart the kernel to use updated packages.\n",
305
+ "Defaulting to user installation because normal site-packages is not writeable\n",
306
+ "Collecting timm\n",
307
+ " Using cached timm-0.9.2-py3-none-any.whl (2.2 MB)\n",
308
+ "Collecting safetensors\n",
309
+ " Downloading safetensors-0.3.1-cp39-cp39-macosx_10_11_x86_64.whl (400 kB)\n",
310
+ "\u001b[K |████████████████████████████████| 400 kB 1.5 MB/s eta 0:00:01\n",
311
+ "\u001b[?25hRequirement already satisfied: pyyaml in /Users/alex/Library/Python/3.9/lib/python/site-packages (from timm) (6.0)\n",
312
+ "Requirement already satisfied: torch>=1.7 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from timm) (2.0.1)\n",
313
+ "Requirement already satisfied: huggingface-hub in /Users/alex/Library/Python/3.9/lib/python/site-packages (from timm) (0.15.1)\n",
314
+ "Requirement already satisfied: torchvision in /Users/alex/Library/Python/3.9/lib/python/site-packages (from timm) (0.15.2)\n",
315
+ "Requirement already satisfied: typing-extensions in /Users/alex/Library/Python/3.9/lib/python/site-packages (from torch>=1.7->timm) (4.6.3)\n",
316
+ "Requirement already satisfied: jinja2 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from torch>=1.7->timm) (3.1.2)\n",
317
+ "Requirement already satisfied: networkx in /Users/alex/Library/Python/3.9/lib/python/site-packages (from torch>=1.7->timm) (3.1)\n",
318
+ "Requirement already satisfied: sympy in /Users/alex/Library/Python/3.9/lib/python/site-packages (from torch>=1.7->timm) (1.12)\n",
319
+ "Requirement already satisfied: filelock in /Users/alex/Library/Python/3.9/lib/python/site-packages (from torch>=1.7->timm) (3.12.0)\n",
320
+ "Requirement already satisfied: tqdm>=4.42.1 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from huggingface-hub->timm) (4.65.0)\n",
321
+ "Requirement already satisfied: fsspec in /Users/alex/Library/Python/3.9/lib/python/site-packages (from huggingface-hub->timm) (2023.5.0)\n",
322
+ "Requirement already satisfied: requests in /Users/alex/Library/Python/3.9/lib/python/site-packages (from huggingface-hub->timm) (2.31.0)\n",
323
+ "Requirement already satisfied: packaging>=20.9 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from huggingface-hub->timm) (23.1)\n",
324
+ "Requirement already satisfied: MarkupSafe>=2.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from jinja2->torch>=1.7->timm) (2.1.3)\n",
325
+ "Requirement already satisfied: idna<4,>=2.5 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from requests->huggingface-hub->timm) (3.4)\n",
326
+ "Requirement already satisfied: certifi>=2017.4.17 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from requests->huggingface-hub->timm) (2023.5.7)\n",
327
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from requests->huggingface-hub->timm) (3.1.0)\n",
328
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from requests->huggingface-hub->timm) (2.0.2)\n",
329
+ "Requirement already satisfied: mpmath>=0.19 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from sympy->torch>=1.7->timm) (1.3.0)\n",
330
+ "Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /Users/alex/Library/Python/3.9/lib/python/site-packages (from torchvision->timm) (9.5.0)\n",
331
+ "Requirement already satisfied: numpy in /Users/alex/Library/Python/3.9/lib/python/site-packages (from torchvision->timm) (1.24.3)\n"
332
+ ]
333
+ }
334
+ ],
335
+ "source": [
336
+ "%pip install fastai\n",
337
+ "%pip install gradio\n",
338
+ "%pip install timm"
339
+ ]
340
+ },
341
+ {
342
+ "cell_type": "code",
343
+ "execution_count": null,
344
+ "metadata": {},
345
+ "outputs": [],
346
+ "source": [
347
+ "from fastai.vision.all import *\n",
348
+ "import gradio as gr\n",
349
+ "import pathlib\n",
350
+ "import pathlib\n",
351
+ "temp = pathlib.PosixPath\n",
352
+ "pathlib.PosixPath = pathlib.WindowsPath\n",
353
+ "import timm"
354
+ ]
355
+ },
356
+ {
357
+ "cell_type": "code",
358
+ "execution_count": null,
359
+ "metadata": {},
360
+ "outputs": [],
361
+ "source": [
362
+ "\n"
363
+ ]
364
+ },
365
+ {
366
+ "cell_type": "code",
367
+ "execution_count": null,
368
+ "metadata": {},
369
+ "outputs": [
370
+ {
371
+ "ename": "FileNotFoundError",
372
+ "evalue": "[Errno 2] No such file or directory: 'Benign1.jpg'",
373
+ "output_type": "error",
374
+ "traceback": [
375
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
376
+ "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
377
+ "\u001b[0;32m/var/folders/gm/h3z3dxv12z73tt5_q7j7kc6h0000gn/T/ipykernel_97601/3272737616.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mim\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mPILImage\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Benign1.jpg'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mthumbnail\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m192\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m192\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
378
+ "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/fastai/vision/core.py\u001b[0m in \u001b[0;36mcreate\u001b[0;34m(cls, fn, **kwargs)\u001b[0m\n\u001b[1;32m 123\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mbytes\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mfn\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mio\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mBytesIO\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 124\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mImage\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mImage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mcls\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 125\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mcls\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mload_image\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mmerge\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcls\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_open_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 126\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 127\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mctx\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
379
+ "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/fastai/vision/core.py\u001b[0m in \u001b[0;36mload_image\u001b[0;34m(fn, mode)\u001b[0m\n\u001b[1;32m 96\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mload_image\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;34m\"Open and load a `PIL.Image` and convert to `mode`\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 98\u001b[0;31m \u001b[0mim\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mImage\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 99\u001b[0m \u001b[0mim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 100\u001b[0m \u001b[0mim\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_new\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mim\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
380
+ "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/Image.py\u001b[0m in \u001b[0;36mopen\u001b[0;34m(fp, mode, formats)\u001b[0m\n\u001b[1;32m 3234\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3235\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3236\u001b[0;31m \u001b[0mfp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mbuiltins\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"rb\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3237\u001b[0m \u001b[0mexclusive_fp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3238\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
381
+ "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'Benign1.jpg'"
382
+ ]
383
+ }
384
+ ],
385
+ "source": [
386
+ " # im = PILImage.create('Benign1.jpg')\n",
387
+ " # im.thumbnail((192,192))\n"
388
+ ]
389
+ },
390
+ {
391
+ "cell_type": "code",
392
+ "execution_count": null,
393
+ "metadata": {},
394
+ "outputs": [
395
+ {
396
+ "ename": "NotImplementedError",
397
+ "evalue": "cannot instantiate 'WindowsPath' on your system",
398
+ "output_type": "error",
399
+ "traceback": [
400
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
401
+ "\u001b[0;31mNotImplementedError\u001b[0m Traceback (most recent call last)",
402
+ "\u001b[0;32m/var/folders/gm/h3z3dxv12z73tt5_q7j7kc6h0000gn/T/ipykernel_97601/243768304.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlearn\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mload_learner\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'export.pkl'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
403
+ "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/fastai/learner.py\u001b[0m in \u001b[0;36mload_learner\u001b[0;34m(fname, cpu, pickle_module)\u001b[0m\n\u001b[1;32m 444\u001b[0m \u001b[0mdistrib_barrier\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 445\u001b[0m \u001b[0mmap_loc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'cpu'\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcpu\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0mdefault_device\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 446\u001b[0;31m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmap_location\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmap_loc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpickle_module\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mpickle_module\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 447\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mAttributeError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 448\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34mf\"Custom classes or functions exported with your `Learner` not available in namespace.\\Re-declare/import before loading:\\n\\t{e.args[0]}\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
404
+ "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torch/serialization.py\u001b[0m in \u001b[0;36mload\u001b[0;34m(f, map_location, pickle_module, weights_only, **pickle_load_args)\u001b[0m\n\u001b[1;32m 787\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mRuntimeError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 788\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mpickle\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mUnpicklingError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mUNSAFE_MESSAGE\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 789\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0m_load\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mopened_zipfile\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmap_location\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpickle_module\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mpickle_load_args\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 790\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mweights_only\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 791\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
405
+ "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torch/serialization.py\u001b[0m in \u001b[0;36m_load\u001b[0;34m(zip_file, map_location, pickle_module, pickle_file, **pickle_load_args)\u001b[0m\n\u001b[1;32m 1129\u001b[0m \u001b[0munpickler\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mUnpicklerWrapper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata_file\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mpickle_load_args\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1130\u001b[0m \u001b[0munpickler\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpersistent_load\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpersistent_load\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1131\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0munpickler\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1132\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1133\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_utils\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_validate_loaded_sparse_tensors\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
406
+ "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pathlib.py\u001b[0m in \u001b[0;36m__new__\u001b[0;34m(cls, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1023\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_flavour\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_supported\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1024\u001b[0m raise NotImplementedError(\"cannot instantiate %r on your system\"\n\u001b[0;32m-> 1025\u001b[0;31m % (cls.__name__,))\n\u001b[0m\u001b[1;32m 1026\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_init\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1027\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
407
+ "\u001b[0;31mNotImplementedError\u001b[0m: cannot instantiate 'WindowsPath' on your system"
408
+ ]
409
+ }
410
+ ],
411
+ "source": [
412
+ "learn = load_learner('export.pkl')"
413
+ ]
414
+ },
415
+ {
416
+ "cell_type": "code",
417
+ "execution_count": null,
418
+ "metadata": {},
419
+ "outputs": [
420
+ {
421
+ "data": {
422
+ "text/plain": [
423
+ "('benign', tensor(0), tensor([0.8787, 0.1213]))"
424
+ ]
425
+ },
426
+ "execution_count": 6,
427
+ "metadata": {},
428
+ "output_type": "execute_result"
429
+ }
430
+ ],
431
+ "source": [
432
+ "learn.predict(im)"
433
+ ]
434
+ },
435
+ {
436
+ "cell_type": "code",
437
+ "execution_count": null,
438
+ "metadata": {},
439
+ "outputs": [],
440
+ "source": [
441
+ "categories = ('Benign', 'Malignant')\n",
442
+ "\n",
443
+ "def classify_image(img):\n",
444
+ " pred,idx,probs = learn.predict(img)\n",
445
+ " return dict(zip(categories, map(float,probs)))"
446
+ ]
447
+ },
448
+ {
449
+ "cell_type": "code",
450
+ "execution_count": null,
451
+ "metadata": {},
452
+ "outputs": [
453
+ {
454
+ "data": {
455
+ "text/plain": [
456
+ "{'Benign': 0.8787491321563721, 'Malignant': 0.12125089019536972}"
457
+ ]
458
+ },
459
+ "execution_count": 8,
460
+ "metadata": {},
461
+ "output_type": "execute_result"
462
+ }
463
+ ],
464
+ "source": [
465
+ "classify_image(im)"
466
+ ]
467
+ },
468
+ {
469
+ "cell_type": "code",
470
+ "execution_count": null,
471
+ "metadata": {},
472
+ "outputs": [
473
+ {
474
+ "name": "stderr",
475
+ "output_type": "stream",
476
+ "text": [
477
+ "c:\\Users\\ntram\\Anaconda3\\lib\\site-packages\\gradio\\inputs.py:259: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
478
+ " warnings.warn(\n",
479
+ "c:\\Users\\ntram\\Anaconda3\\lib\\site-packages\\gradio\\inputs.py:262: UserWarning: `optional` parameter is deprecated, and it has no effect\n",
480
+ " super().__init__(\n",
481
+ "c:\\Users\\ntram\\Anaconda3\\lib\\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",
482
+ " warnings.warn(\n",
483
+ "c:\\Users\\ntram\\Anaconda3\\lib\\site-packages\\gradio\\outputs.py:200: UserWarning: The 'type' parameter has been deprecated. Use the Number component instead.\n",
484
+ " super().__init__(num_top_classes=num_top_classes, type=type, label=label)\n"
485
+ ]
486
+ },
487
+ {
488
+ "name": "stdout",
489
+ "output_type": "stream",
490
+ "text": [
491
+ "Running on local URL: http://127.0.0.1:7860\n",
492
+ "\n",
493
+ "To create a public link, set `share=True` in `launch()`.\n"
494
+ ]
495
+ },
496
+ {
497
+ "data": {
498
+ "text/plain": []
499
+ },
500
+ "execution_count": 9,
501
+ "metadata": {},
502
+ "output_type": "execute_result"
503
+ },
504
+ {
505
+ "data": {
506
+ "text/html": [
507
+ "\n",
508
+ "<style>\n",
509
+ " /* Turns off some styling */\n",
510
+ " progress {\n",
511
+ " /* gets rid of default border in Firefox and Opera. */\n",
512
+ " border: none;\n",
513
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
514
+ " background-size: auto;\n",
515
+ " }\n",
516
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
517
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
518
+ " }\n",
519
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
520
+ " background: #F44336;\n",
521
+ " }\n",
522
+ "</style>\n"
523
+ ],
524
+ "text/plain": [
525
+ "<IPython.core.display.HTML object>"
526
+ ]
527
+ },
528
+ "metadata": {},
529
+ "output_type": "display_data"
530
+ },
531
+ {
532
+ "data": {
533
+ "text/html": [
534
+ "\n",
535
+ "<style>\n",
536
+ " /* Turns off some styling */\n",
537
+ " progress {\n",
538
+ " /* gets rid of default border in Firefox and Opera. */\n",
539
+ " border: none;\n",
540
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
541
+ " background-size: auto;\n",
542
+ " }\n",
543
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
544
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
545
+ " }\n",
546
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
547
+ " background: #F44336;\n",
548
+ " }\n",
549
+ "</style>\n"
550
+ ],
551
+ "text/plain": [
552
+ "<IPython.core.display.HTML object>"
553
+ ]
554
+ },
555
+ "metadata": {},
556
+ "output_type": "display_data"
557
+ },
558
+ {
559
+ "data": {
560
+ "text/html": [
561
+ "\n",
562
+ "<style>\n",
563
+ " /* Turns off some styling */\n",
564
+ " progress {\n",
565
+ " /* gets rid of default border in Firefox and Opera. */\n",
566
+ " border: none;\n",
567
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
568
+ " background-size: auto;\n",
569
+ " }\n",
570
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
571
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
572
+ " }\n",
573
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
574
+ " background: #F44336;\n",
575
+ " }\n",
576
+ "</style>\n"
577
+ ],
578
+ "text/plain": [
579
+ "<IPython.core.display.HTML object>"
580
+ ]
581
+ },
582
+ "metadata": {},
583
+ "output_type": "display_data"
584
+ },
585
+ {
586
+ "data": {
587
+ "text/html": [
588
+ "\n",
589
+ " <div>\n",
590
+ " <progress value='0' class='' max='1' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
591
+ " \n",
592
+ " </div>\n",
593
+ " "
594
+ ],
595
+ "text/plain": [
596
+ "<IPython.core.display.HTML object>"
597
+ ]
598
+ },
599
+ "metadata": {},
600
+ "output_type": "display_data"
601
+ },
602
+ {
603
+ "data": {
604
+ "text/html": [
605
+ "\n",
606
+ "<style>\n",
607
+ " /* Turns off some styling */\n",
608
+ " progress {\n",
609
+ " /* gets rid of default border in Firefox and Opera. */\n",
610
+ " border: none;\n",
611
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
612
+ " background-size: auto;\n",
613
+ " }\n",
614
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
615
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
616
+ " }\n",
617
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
618
+ " background: #F44336;\n",
619
+ " }\n",
620
+ "</style>\n"
621
+ ],
622
+ "text/plain": [
623
+ "<IPython.core.display.HTML object>"
624
+ ]
625
+ },
626
+ "metadata": {},
627
+ "output_type": "display_data"
628
+ },
629
+ {
630
+ "data": {
631
+ "text/html": [
632
+ "\n",
633
+ " <div>\n",
634
+ " <progress value='0' class='' max='1' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
635
+ " \n",
636
+ " </div>\n",
637
+ " "
638
+ ],
639
+ "text/plain": [
640
+ "<IPython.core.display.HTML object>"
641
+ ]
642
+ },
643
+ "metadata": {},
644
+ "output_type": "display_data"
645
+ }
646
+ ],
647
+ "source": [
648
+ "image = gr.inputs.Image(shape=(192,192))\n",
649
+ "label = gr.outputs.Label()\n",
650
+ "examples = ['Benign1.jpg','Benign2.jpg','Benign3.jpg', 'Malignant1.jpg', 'Malignant2.jpg', 'Malignant3.jpg']\n",
651
+ "\n",
652
+ "intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)\n",
653
+ "intf.launch(inline=False)"
654
+ ]
655
+ },
656
+ {
657
+ "cell_type": "code",
658
+ "execution_count": null,
659
+ "metadata": {},
660
+ "outputs": [],
661
+ "source": []
662
+ }
663
+ ],
664
+ "metadata": {
665
+ "kernelspec": {
666
+ "display_name": "base",
667
+ "language": "python",
668
+ "name": "python3"
669
+ },
670
+ "language_info": {
671
+ "codemirror_mode": {
672
+ "name": "ipython",
673
+ "version": 3
674
+ },
675
+ "file_extension": ".py",
676
+ "mimetype": "text/x-python",
677
+ "name": "python",
678
+ "nbconvert_exporter": "python",
679
+ "pygments_lexer": "ipython3",
680
+ "version": "3.7.6"
681
+ },
682
+ "orig_nbformat": 4
683
+ },
684
+ "nbformat": 4,
685
+ "nbformat_minor": 2
686
+ }
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+ learn = load_learner('export.pkl')
4
+
5
+ categories = ('Benign', 'Malignant')
6
+
7
+
8
+ def classify_image(img):
9
+ pred,idx,probs = learn.predict(img)
10
+ return dict(zip(categories, map(float,probs)))
11
+
12
+ image = gr.inputs.Image(shape=(192,192))
13
+ label = gr.outputs.Label()
14
+ examples = ['Benign 1.jpg','Benign 2.jpg','Benign 3.jpg', 'Malignant 1.jpg',
15
+ 'Malignant 2.jpg', 'Malignant 3.jpg']
16
+
17
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
18
+ intf.launch(inline=False)
19
+
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df104c05b8c1043f4120501d5ad99bc4c7e082464d48db3038b54aff5064c0cc
3
+ size 114811675
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ timm