-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.py
62 lines (52 loc) · 1.47 KB
/
App.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 30 02:10:20 2020
@author: HP EliteBook 840
"""
import pandas as pd
import numpy as np
import pickle
import joblib
import streamlit as st
pickle_in=open('logit.pkl', 'rb')
classifier=pickle.load(pickle_in)
cv_model = open('vectorizer.pkl', 'rb')
cv = joblib.load(cv_model)
def welcome():
return "welcome All"
def malicious_url_prediction(url):
"""Let's predict the safety of urls
This is using docstrings for specifications.
---
parameters:
- name: url
in: query
type: string
required: true
responses:
200:
description: The output values
"""
int_features = st.text_input("url")
data=[int_features]
vect =cv.transform(data)
prediction = classifier.predict(vect)[0]
print(prediction)
return prediction
def main():
st.title("Malicious URL Prediction App")
html_temp = """
<div style="background-color:tomato;padding:10px">
<h2 style="color:white;text-align:center;">Streamlit Malicious URL Prediction ML App </h2>
</div>
"""
st.markdown(html_temp,unsafe_allow_html=True)
url = st.text_input("url","Type Here")
result=""
if st.button("Predict"):
result=malicious_url_prediction(url)
st.success('The URL is {}'.format(result))
if st.button("About"):
st.text("Built with Streamlit")
if __name__=='__main__':
main()