Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ from huggingface_hub import from_pretrained_fastai
|
|
2 |
import gradio as gr
|
3 |
from fastai.text.all import *
|
4 |
|
5 |
-
|
6 |
# repo_id = "YOUR_USERNAME/YOUR_LEARNER_NAME"
|
7 |
repo_id = "allopeap/emociones"
|
8 |
|
@@ -11,14 +10,13 @@ labels = learner.dls.vocab
|
|
11 |
|
12 |
# Definimos una funci贸n que se encarga de llevar a cabo las predicciones
|
13 |
def predict(txt):
|
14 |
-
|
15 |
-
pred,pred_idx,probs = learner.predict(txt)
|
16 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
17 |
-
|
18 |
# Creamos la interfaz y la lanzamos.
|
19 |
gr.Interface(
|
20 |
fn=predict,
|
21 |
inputs=gr.inputs.Textbox(lines=2, placeholder="Ingresa el texto aqu铆..."),
|
22 |
outputs=gr.outputs.Label(num_top_classes=3),
|
23 |
-
examples=[['
|
24 |
-
).launch(share=False)
|
|
|
2 |
import gradio as gr
|
3 |
from fastai.text.all import *
|
4 |
|
|
|
5 |
# repo_id = "YOUR_USERNAME/YOUR_LEARNER_NAME"
|
6 |
repo_id = "allopeap/emociones"
|
7 |
|
|
|
10 |
|
11 |
# Definimos una funci贸n que se encarga de llevar a cabo las predicciones
|
12 |
def predict(txt):
|
13 |
+
pred, _, probs = learner.predict(txt)
|
|
|
14 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
15 |
+
|
16 |
# Creamos la interfaz y la lanzamos.
|
17 |
gr.Interface(
|
18 |
fn=predict,
|
19 |
inputs=gr.inputs.Textbox(lines=2, placeholder="Ingresa el texto aqu铆..."),
|
20 |
outputs=gr.outputs.Label(num_top_classes=3),
|
21 |
+
examples=[['Me siento muy feliz hoy'], ['Estoy triste'], ['Tengo miedo']]
|
22 |
+
).launch(share=False)
|