Alex Gonzalez
commited on
Commit
·
25e8fcd
1
Parent(s):
c01ade7
Bugfix
Browse files
app.py
CHANGED
@@ -6,8 +6,8 @@ from PIL import Image
|
|
6 |
learn_inf = load_learner("export.pkl")
|
7 |
|
8 |
def predict(value: Image) -> str:
|
9 |
-
img = value.convert('LA')
|
10 |
-
pred,pred_idx,probs = learn_inf.predict(
|
11 |
return f"{pred} at {probs[pred_idx]}"
|
12 |
|
13 |
with gr.Blocks() as demo:
|
@@ -16,7 +16,7 @@ with gr.Blocks() as demo:
|
|
16 |
input_img = gr.Image(label="Input", sources="webcam")
|
17 |
with gr.Column():
|
18 |
output_lbl = gr.Label(value="Output", label="Expression Prediction")
|
19 |
-
input_img.stream(fn=predict, inputs=
|
20 |
|
21 |
if __name__ == "__main__":
|
22 |
|
|
|
6 |
learn_inf = load_learner("export.pkl")
|
7 |
|
8 |
def predict(value: Image) -> str:
|
9 |
+
img = Image.fromarray(value).convert('LA')
|
10 |
+
pred,pred_idx,probs = learn_inf.predict(img)
|
11 |
return f"{pred} at {probs[pred_idx]}"
|
12 |
|
13 |
with gr.Blocks() as demo:
|
|
|
16 |
input_img = gr.Image(label="Input", sources="webcam")
|
17 |
with gr.Column():
|
18 |
output_lbl = gr.Label(value="Output", label="Expression Prediction")
|
19 |
+
input_img.stream(fn=predict, inputs=input_img, outputs=output_lbl, time_limit=15, stream_every=0.1, concurrency_limit=30)
|
20 |
|
21 |
if __name__ == "__main__":
|
22 |
|