Rehman1603's picture
Create app.py
fc40723
import gradio as gr
import pickle
with open("Email.pkl","rb") as f:
model_info=pickle.load(f)
with open("Vector.pkl","rb") as f:
vector_info=pickle.load(f)
def Email_Prediction(news):
input_data=[news]
vector_form=vector_info.transform(input_data)
result=model_info.predict(vector_form)
if(result[0]==0):
ans="Ham Email"
else:
ans="Spam Email"
return ans
interface=gr.Interface(fn=Email_Prediction,inputs=[gr.components.Textbox(lines=2,placeholder="Email...",label="Enter Email")],
outputs=[gr.components.Textbox(label="Your Result")],
examples=[
['man threatens explosion in moscow thursday august NUMBER NUMBER NUMBER NUMBER pm moscow ap security officers on thursday seized an unidentified man who said he was armed with explosives and threatened to blow up his truck in front of russia s federal security services headquarters in moscow ntv television reported the officers seized an automatic rifle the man was carrying then the man got out of the truck and was taken into custody ntv said no other details were immediately available the man had demanded talks with high government officials the interfax and itar tass news agencies said ekho moskvy radio reported that he wanted to talk with russian president vladimir putin police and security forces rushed to the security service building within blocks of the kremlin red square and the bolshoi ballet and surrounded the man who claimed to have one and a half tons of explosives the news agencies said negotiations continued for about one and a half hours outside the building itar tass and interfax reported citing witnesses the man later drove away from the building under police escort and drove to a street near moscow s olympic penta hotel where authorities held further negotiations with him the moscow police press service said the move appeared to be an attempt by security services to get him to a more secure location yahoo groups sponsor NUMBER dvds free s p join now URL to unsubscribe from this group send an email to forteana unsubscribe URL your use of yahoo groups is subject to URL']
]
)
interface.launch(debug=True)