File size: 988 Bytes
eb71970
 
807e457
eb71970
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import gradio as gr
import pickle



with open("News_Model.pkl","rb") as f:
  model_info=pickle.load(f)

with open("Vector.pkl","rb") as f:
  vector_info=pickle.load(f)

def News_Prediction(news):
  input_data=[news]
  vector_form=vector_info.transform(input_data)
  result=model_info.predict(vector_form)
  if(result[0]==0):
    ans="It is Fake News"
  else:
    ans="It is Real News"
  return ans


interface=gr.Interface(fn=News_Prediction,inputs=[gr.components.Textbox(lines=2,placeholder="News...",label="Enter News")],
                       outputs=[gr.components.Textbox(label="Your Result")],
                       examples=[
                          ["In 1999, Sharif was overthrown by a military coup that brought army chief General Pervez Musharraf to power. Sharif subsequently went into exile in Saudi Arabia, before returning to Pakistan in 2007 as Musharraf's grip on power began to slip."]
                       ]
                       )

interface.launch(debug=True)