Spaces:
Runtime error
Runtime error
Update app.py
Browse filesadded the new labels
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 = {'
|
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="
|
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()
|