Asis commited on
Commit
ed9f87c
1 Parent(s): 74fed13

Edit labels

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -5,6 +5,10 @@ import skimage
5
  learn = load_learner('model.pkl')
6
 
7
  labels = learn.dls.vocab
 
 
 
 
8
  def predict(img):
9
  img = PILImage.create(img)
10
  pred,pred_idx,probs = learn.predict(img)
@@ -18,3 +22,4 @@ interpretation = 'default'
18
  enable_queue = True
19
 
20
  gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
 
 
5
  learn = load_learner('model.pkl')
6
 
7
  labels = learn.dls.vocab
8
+
9
+ labels = list(map(lambda x: x.replace('food recipe', 'Food Plate'), labels))
10
+ labels = list(map(lambda x: x.replace('empty plate', 'Empty Plate'), labels))
11
+
12
  def predict(img):
13
  img = PILImage.create(img)
14
  pred,pred_idx,probs = learn.predict(img)
 
22
  enable_queue = True
23
 
24
  gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
25
+