Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,15 +4,16 @@ from fastai.vision.all import *
|
|
4 |
|
5 |
repo_id = "MarioGL/emotion"
|
6 |
|
7 |
-
|
8 |
-
labels = learner.dls.vocab
|
9 |
|
10 |
-
|
11 |
-
def
|
12 |
-
|
13 |
-
pred,pred_idx
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
4 |
|
5 |
repo_id = "MarioGL/emotion"
|
6 |
|
7 |
+
learn = load_learner(f'{repo_id}/model.pkl')
|
|
|
8 |
|
9 |
+
|
10 |
+
def classify_text(text):
|
11 |
+
pred, pred_idx, probs = learn.predict(text)
|
12 |
+
return pred, probs[pred_idx].item()
|
13 |
+
|
14 |
+
iface = gr.Interface(fn=classify_text,
|
15 |
+
inputs=gr.Textbox(label="Introduce un texto"),
|
16 |
+
outputs=[gr.Label(), gr.Textbox()],
|
17 |
+
live=True)
|
18 |
+
|
19 |
+
iface.launch()
|