levjam commited on
Commit
f49e365
·
1 Parent(s): 4f64f78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -1,8 +1,7 @@
1
  import gradio as gr
2
  from fastai.vision.all import *
3
 
4
-
5
- learn = load_learner("export.pkl")
6
 
7
  labels = learn.dls.vocab
8
  def predict(img):
@@ -11,14 +10,14 @@ def predict(img):
11
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
 
13
  title = "Bear classifier"
14
- description = "It can only do panda, polar or spectacled bears so far..."
15
  interpretation= "default"
16
- examples = ["panda.jpg","polar.jpg","spectacled.jpg"]
17
 
18
  gr.Interface(fn = predict,
19
  inputs = gr.inputs.Image(shape = (512, 512)),
20
- outputs = gr.outputs.Label(num_top_classes=3),
21
  title = title,
22
  description = description,
23
  examples = examples,
24
- interpretation = interpretation).launch(share=True)
 
1
  import gradio as gr
2
  from fastai.vision.all import *
3
 
4
+ learn = load_learner("export_5cats.pkl")
 
5
 
6
  labels = learn.dls.vocab
7
  def predict(img):
 
10
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
11
 
12
  title = "Bear classifier"
13
+ description = "It can only do panda, polar or spectacled, black, grizzly and teddy bears so far... Trained using resnet18 and the fastai library"
14
  interpretation= "default"
15
+ examples = ["panda.jpg","polar.jpg","spectacled.jpg","black.jpg","grizzly.jpg","teddy.jpg"]
16
 
17
  gr.Interface(fn = predict,
18
  inputs = gr.inputs.Image(shape = (512, 512)),
19
+ outputs = gr.outputs.Label(num_top_classes=5),
20
  title = title,
21
  description = description,
22
  examples = examples,
23
+ interpretation = interpretation).launch()sssssssssssssssssssssssssssssssssssssssss