Practica7 / app.py
FJC's picture
Update app.py
0d27b13
from fastai.text.all import *
import gradio as gr
# Cargamos el learner
learn = load_learner('export.pkl')
# Definimos una función que se encarga de llevar a cabo las predicciones
def predict(text):
pred = learn.predict(text)
return pred
# Establecemos el título de la App y también indicamos
title = "Fake-News Detector"
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"
texto1 = "Iran President Hassan Rouhani has more Cabinet members with Ph.D.s from American universities than members of Barack Obamas Cabinet."
texto2 = "Says At age 76 when you most need it, you are not eligible for cancer treatment under Affordable Care Act."
texto3 = "More than 250 (voter registration) groups, ranging across the entire political spectrum, have filed with the state and are registering voters right now."
# Creamos la interfaz y la lanzamos.
gr.Interface(fn=predict, inputs="text", outputs="text", title=title, description=description, examples=[texto1,texto2, texto3]).launch(share=False)