Sungmin Son commited on
Commit
542596e
1 Parent(s): fd7ac62

No comment

Browse files
Files changed (2) hide show
  1. Untitled-1.ipynb +1 -1
  2. app +0 -30
Untitled-1.ipynb CHANGED
@@ -213,7 +213,7 @@
213
  },
214
  {
215
  "cell_type": "code",
216
- "execution_count": 8,
217
  "metadata": {},
218
  "outputs": [],
219
  "source": [
 
213
  },
214
  {
215
  "cell_type": "code",
216
+ "execution_count": 12,
217
  "metadata": {},
218
  "outputs": [],
219
  "source": [
app DELETED
@@ -1,30 +0,0 @@
1
- # AUTOGENERATED! DO NOT EDIT! File to edit: ../../Untitled-1.ipynb.
2
-
3
- # %% auto 0
4
- __all__ = ['model_path', 'learn', 'categories', 'is_cat', 'classify_image']
5
-
6
- # %% ../../Untitled-1.ipynb 0
7
- import gradio as gr
8
- from fastai.vision.all import *
9
- def is_cat(x): return x[0].isupper()
10
-
11
- # %% ../../Untitled-1.ipynb 2
12
- model_path = Path('model.pkl')
13
- learn = load_learner(model_path)
14
-
15
- # %% ../../Untitled-1.ipynb 4
16
- categories = ('dog', 'cat')
17
-
18
- def classify_image(img):
19
- pred,idx,probs = learn.predict(img)
20
- return dict(zip(categories, map(float,probs)))
21
-
22
-
23
- # %% ../../Untitled-1.ipynb 6
24
- gr.Interface(fn = classify_image,
25
- inputs="image",
26
- outputs="label",
27
- title = "Dog or Cat",
28
- description="Sample workflow",
29
- examples = ['dog.jpg']
30
- ).launch()