FJC commited on
Commit
0d27b13
1 Parent(s): 992982d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.text.all import *
2
+ import gradio as gr
3
+
4
+
5
+ # Cargamos el learner
6
+ learn = load_learner('export.pkl')
7
+
8
+
9
+ # Definimos una función que se encarga de llevar a cabo las predicciones
10
+ def predict(text):
11
+ pred = learn.predict(text)
12
+ return pred
13
+
14
+ # Establecemos el título de la App y también indicamos
15
+ title = "Fake-News Detector"
16
+ description = "A Fake-News detector trained on HuggingFace LIAR dataset with fastai. It classifies news in 6 categories ranging from 0 to 5: [0]- False, [1]-Half-True, [2]-Mostly-True, [3]-True, [4]-Barely-True, and [5]-Pants-Fire"
17
+
18
+ texto1 = "Iran President Hassan Rouhani has more Cabinet members with Ph.D.s from American universities than members of Barack Obamas Cabinet."
19
+
20
+ texto2 = "Says At age 76 when you most need it, you are not eligible for cancer treatment under Affordable Care Act."
21
+
22
+ texto3 = "More than 250 (voter registration) groups, ranging across the entire political spectrum, have filed with the state and are registering voters right now."
23
+
24
+ # Creamos la interfaz y la lanzamos.
25
+ gr.Interface(fn=predict, inputs="text", outputs="text", title=title, description=description, examples=[texto1,texto2, texto3]).launch(share=False)
26
+