Spaces:
Sleeping
Sleeping
| from fastai.vision.all import * | |
| import gradio as gr | |
| # Cargamos el learner | |
| learn = load_learner('export.pkl') | |
| # Definimos las etiquetas de nuestro modelo | |
| labels = ['Negative','Neutral','Positive'] | |
| # Definimos una función que se encarga de llevar a cabo las predicciones | |
| def predict(text): | |
| pred,pred_idx,probs = learn.predict(text) | |
| return {labels[i]: float(probs[i]) for i in range(len(labels))} | |
| # Creamos la interfaz y la lanzamos. | |
| gr.Interface(fn=predict, inputs=gr.Textbox(), outputs=gr.outputs.Label(num_top_classes=3),examples=['Some hate humanity, but I love humanity so much.','I have this old 2006 BusinessWeek framed as a reminder. The “risky bet” that Wall Street disliked was AWS, which generated revenue of more than $62 billion last year.']).launch(share=False) |