|
from fastai.text.all import * |
|
import gradio as gr |
|
|
|
|
|
|
|
learn = load_learner('export.pkl') |
|
|
|
|
|
|
|
def predict(text): |
|
pred = learn.predict(text) |
|
return pred |
|
|
|
|
|
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." |
|
|
|
|
|
gr.Interface(fn=predict, inputs="text", outputs="text", title=title, description=description, examples=[texto1,texto2, texto3]).launch(share=False) |
|
|