macapa commited on
Commit
e5f1341
Β·
1 Parent(s): 2c76f45

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.text.all import *
2
+ import gradio as gr
3
+
4
+ # Cargamos el learner
5
+ learn = load_learner('export.pkl')
6
+
7
+ # Definimos la funciΓ³n que realiza las predicciones
8
+ def predict(text):
9
+ pred = learn.predict(text)
10
+ return pred
11
+
12
+ texto1 = 'i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake'
13
+ texto2 = 'im grabbing a minute to post i feel greedy wrong'
14
+ # Creamos la interfaz y la lanzamos.
15
+ gr.Interface(fn=predict, inputs="text", outputs="text",examples=[texto1,texto2]).launch(share=False)