File size: 541 Bytes
619fb86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()