aopp
Browse files
app.py
CHANGED
|
@@ -11,10 +11,13 @@ dls_path = "dls_origin-classifier_v1.pkl"
|
|
| 11 |
|
| 12 |
learner_inf = load_learner(model_path)
|
| 13 |
|
|
|
|
| 14 |
dls = torch.load(dls_path)
|
| 15 |
|
|
|
|
| 16 |
class_label_mapping = {label: idx for idx, label in enumerate(learner_inf.dls.vocab)}
|
| 17 |
|
|
|
|
| 18 |
def predict_text(text):
|
| 19 |
prediction = learner_inf.blurr_predict(text)
|
| 20 |
predicted_probs = prediction[0]['scores']
|
|
@@ -24,10 +27,11 @@ def predict_text(text):
|
|
| 24 |
|
| 25 |
iface = gr.Interface(
|
| 26 |
fn=predict_text,
|
| 27 |
-
inputs=
|
| 28 |
-
outputs=
|
| 29 |
title="Food Origin Classification App",
|
| 30 |
description="Enter a Recipe, and it will predict the class label.",
|
| 31 |
)
|
| 32 |
|
|
|
|
| 33 |
iface.launch()
|
|
|
|
| 11 |
|
| 12 |
learner_inf = load_learner(model_path)
|
| 13 |
|
| 14 |
+
|
| 15 |
dls = torch.load(dls_path)
|
| 16 |
|
| 17 |
+
|
| 18 |
class_label_mapping = {label: idx for idx, label in enumerate(learner_inf.dls.vocab)}
|
| 19 |
|
| 20 |
+
|
| 21 |
def predict_text(text):
|
| 22 |
prediction = learner_inf.blurr_predict(text)
|
| 23 |
predicted_probs = prediction[0]['scores']
|
|
|
|
| 27 |
|
| 28 |
iface = gr.Interface(
|
| 29 |
fn=predict_text,
|
| 30 |
+
inputs="text",
|
| 31 |
+
outputs="text",
|
| 32 |
title="Food Origin Classification App",
|
| 33 |
description="Enter a Recipe, and it will predict the class label.",
|
| 34 |
)
|
| 35 |
|
| 36 |
+
|
| 37 |
iface.launch()
|