YUGOROU commited on
Commit
503c8b2
Β·
1 Parent(s): 1b928a8

Fix label outputs with Japanese names

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -27,6 +27,12 @@ def load_model():
27
  model.load_state_dict(filtered_state, strict=False)
28
  model.eval()
29
  device = 0 if torch.cuda.is_available() else -1
 
 
 
 
 
 
30
  pipe = pipeline(
31
  "image-classification",
32
  model=model,
 
27
  model.load_state_dict(filtered_state, strict=False)
28
  model.eval()
29
  device = 0 if torch.cuda.is_available() else -1
30
+ model.config.id2label = {
31
+ 0: "うどん",
32
+ 1: "θ•ŽιΊ¦",
33
+ 2: "どけらでもγͺい",
34
+ }
35
+ model.config.label2id = {v: k for k, v in model.config.id2label.items()}
36
  pipe = pipeline(
37
  "image-classification",
38
  model=model,