blancamartin commited on
Commit
406d0cc
1 Parent(s): e80adfc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ from fastai.text.all import *
3
+ from datasets import load_dataset
4
+
5
+ import gradio as gr
6
+
7
+
8
+ # Cargamos el learner
9
+ learn = load_learner('export-2.pkl')
10
+
11
+ # Definimos las etiquetas de nuestro modelo
12
+ labels = learn.dls.vocab
13
+
14
+
15
+ # Definimos una función que se encarga de llevar a cabo las predicciones
16
+ def predict(text):
17
+ #img = PILImage.create(img)
18
+ pred,pred_idx,probs = learn.predict(text)
19
+ return pred
20
+
21
+ # Creamos la interfaz y la lanzamos.
22
+ gr.Interface(fn=predict, inputs="text", outputs="text",examples=['I will go to see him without telling him about it--.']).launch(share=False)