RealityCheck / app.py
Yousfi101's picture
Update app.py
807e457
raw
history blame
988 Bytes
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)