ByteBlaze's picture
Create app.py
619fb86 verified
raw history blame
No virus
541 Bytes
import gradio as gr
from sklearn.feature_extraction.text import CountVectorizer
import joblib
vectorizer = CountVectorizer()
nb_classifier = joblib.load('./nb_classifier.pkl')
def classify(text):
corpus=[text]
features = vectorizer.transform(corpus)
features = features.toarray()
prediction = nb_classifier.predict(features)
if(prediction == 1):
return "Fake News"
else:
return "Not Fake News"
GUI = gr.Interface(inputs = ['text'], outputs = ['text'], fn = classify, title = "Fake News Detection System")
GUI.launch()