Spaces:
Sleeping
Sleeping
Raphaël Bournhonesque
commited on
Commit
·
40f633f
1
Parent(s):
e1c69f9
fix
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import enum
|
2 |
import os
|
3 |
from typing import Optional
|
@@ -28,7 +29,7 @@ else:
|
|
28 |
PREDICTION_URL = ROBOTOFF_BASE_URL + "/predict/category"
|
29 |
|
30 |
|
31 |
-
@st.
|
32 |
def get_predictions(barcode: str, model_name: str, threshold: Optional[float] = None):
|
33 |
data = {"barcode": barcode, "predictors": ["neural"], "neural_model_name": model_name}
|
34 |
if threshold is not None:
|
@@ -46,7 +47,7 @@ def display_predictions(
|
|
46 |
debug_showed = False
|
47 |
for model_name in model_names:
|
48 |
response = get_predictions(barcode, model_name, threshold)
|
49 |
-
|
50 |
if "debug" in response:
|
51 |
if not debug_showed:
|
52 |
debug_showed = True
|
|
|
1 |
+
import copy
|
2 |
import enum
|
3 |
import os
|
4 |
from typing import Optional
|
|
|
29 |
PREDICTION_URL = ROBOTOFF_BASE_URL + "/predict/category"
|
30 |
|
31 |
|
32 |
+
@st.cache
|
33 |
def get_predictions(barcode: str, model_name: str, threshold: Optional[float] = None):
|
34 |
data = {"barcode": barcode, "predictors": ["neural"], "neural_model_name": model_name}
|
35 |
if threshold is not None:
|
|
|
47 |
debug_showed = False
|
48 |
for model_name in model_names:
|
49 |
response = get_predictions(barcode, model_name, threshold)
|
50 |
+
response = copy.deepcopy(response)
|
51 |
if "debug" in response:
|
52 |
if not debug_showed:
|
53 |
debug_showed = True
|