Chinat commited on
Commit
9d1026d
1 Parent(s): d102119

Update app.py

Browse files

added the new labels

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -7,7 +7,7 @@ plt = platform.system()
7
  if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
8
 
9
  learn_inf = load_learner("export.pkl")
10
- new_label = {'asian male': '老公', 'glasses asian female': '老婆'}
11
 
12
  def predict_person(img):
13
 
@@ -15,6 +15,6 @@ def predict_person(img):
15
  return f'Prediction: {new_label[pred]}; Probability: {probs[pred_idx]:.04f}'
16
 
17
  gr.inputs.Image(tool=False, optional=False)
18
- webpage = gr.Interface(fn=predict_person, inputs=gr.inputs.Image(tool=False, optional=False), outputs="text", title="Special Detector", live=True, theme="dark-peach", description="It is a special detector...")
19
  # webpage = gr.Interface(fn=predict_person, inputs=gr.inputs.Image(tool=False, optional=False), outputs="text", title="Special Detector", live=True, theme="dark-peach", description="It is a special detector...", examples=[["example1.jpg"], ["example2.jpg"], ["example3.jpg"]])
20
  webpage.launch()
 
7
  if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
8
 
9
  learn_inf = load_learner("export.pkl")
10
+ new_label = {'face with mask': 'Student wearing mask', 'human face': 'Report! Student without mask detected'}
11
 
12
  def predict_person(img):
13
 
 
15
  return f'Prediction: {new_label[pred]}; Probability: {probs[pred_idx]:.04f}'
16
 
17
  gr.inputs.Image(tool=False, optional=False)
18
+ webpage = gr.Interface(fn=predict_person, inputs=gr.inputs.Image(tool=False, optional=False), outputs="text", title="Special Detector", live=True, theme="dark-peach", description="Check if a student is wearing a mask")
19
  # webpage = gr.Interface(fn=predict_person, inputs=gr.inputs.Image(tool=False, optional=False), outputs="text", title="Special Detector", live=True, theme="dark-peach", description="It is a special detector...", examples=[["example1.jpg"], ["example2.jpg"], ["example3.jpg"]])
20
  webpage.launch()