Bazyl
commited on
Commit
·
85de7ad
1
Parent(s):
bc56537
rounding and remaking 5 results
Browse files- .gitignore +1 -1
- app.py +3 -3
.gitignore
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
/env/
|
2 |
-
/__pycache__/
|
|
|
1 |
/env/
|
2 |
+
/__pycache__/
|
app.py
CHANGED
@@ -8,9 +8,9 @@ from typing import Tuple, Dict
|
|
8 |
def predict(img) -> Tuple[Dict, float]:
|
9 |
start_time = timer()
|
10 |
classifier = pipeline("image-classification", model="bazyl/gtsrb-model")
|
11 |
-
result = classifier(img, top_k=
|
12 |
response = {result[i]["label"]: result[i]["score"] for i in range(len(result))}
|
13 |
-
pred_time = round(timer() - start_time,
|
14 |
return response, pred_time
|
15 |
|
16 |
title = "GTSRB - German Traffic Sign Recognition by Bazyl Horsey"
|
@@ -24,7 +24,7 @@ demo = gr.Interface(
|
|
24 |
fn=predict,
|
25 |
inputs=gr.Image(type="pil"),
|
26 |
outputs=[
|
27 |
-
gr.Label(num_top_classes=
|
28 |
gr.Number(label="Prediction time (s)"),
|
29 |
],
|
30 |
examples=example_list,
|
|
|
8 |
def predict(img) -> Tuple[Dict, float]:
|
9 |
start_time = timer()
|
10 |
classifier = pipeline("image-classification", model="bazyl/gtsrb-model")
|
11 |
+
result = classifier(img, top_k=5)
|
12 |
response = {result[i]["label"]: result[i]["score"] for i in range(len(result))}
|
13 |
+
pred_time = round(timer() - start_time, 3)
|
14 |
return response, pred_time
|
15 |
|
16 |
title = "GTSRB - German Traffic Sign Recognition by Bazyl Horsey"
|
|
|
24 |
fn=predict,
|
25 |
inputs=gr.Image(type="pil"),
|
26 |
outputs=[
|
27 |
+
gr.Label(num_top_classes=5, label="Predictions"),
|
28 |
gr.Number(label="Prediction time (s)"),
|
29 |
],
|
30 |
examples=example_list,
|