Dharma20 commited on
Commit
d71299d
·
verified ·
1 Parent(s): a72431b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -6,7 +6,7 @@ import gradio as gr
6
  learn = load_learner('model1.pkl')
7
 
8
  # %% ../hugging-space-model-app.ipynb 9
9
- labels = ['Dog','Cat']
10
  def classify_image(img):
11
  img = PILImage.create(img)
12
  pred,pred_idx,probs = learn.predict(img)
@@ -15,7 +15,7 @@ def classify_image(img):
15
  # %% ../hugging-space-model-app.ipynb 11
16
  image = gr.components.Image()
17
  label = gr.components.Label(show_label=True)
18
- examples = ['dog.jpg','cat.jpg']
19
 
20
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
21
  intf.launch(inline=False)
 
6
  learn = load_learner('model1.pkl')
7
 
8
  # %% ../hugging-space-model-app.ipynb 9
9
+ labels = learn.dls.vocab
10
  def classify_image(img):
11
  img = PILImage.create(img)
12
  pred,pred_idx,probs = learn.predict(img)
 
15
  # %% ../hugging-space-model-app.ipynb 11
16
  image = gr.components.Image()
17
  label = gr.components.Label(show_label=True)
18
+ examples = ['afraid.jpg','anger.jpg','happyface.jpg','disgust.jpg','sadface.webp']
19
 
20
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
21
  intf.launch(inline=False)