BSJ2004 commited on
Commit
004dfe5
1 Parent(s): a63fc1e

Upload 2 files

Browse files
Files changed (2) hide show
  1. logistic_regression_model.pkl +3 -0
  2. model.py +36 -0
logistic_regression_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee7c783d2e76ee847a7b759f79f0505537185daf4d5105085c4a8610def7d81d
3
+ size 886
model.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pickle
3
+ import pandas as pd
4
+
5
+ st.title("BEHAIVER PREDICTION")
6
+
7
+ # Load the trained model
8
+ with open(r'C:\Users\hp\Desktop\project\model\accused behaiver\logistic_regression_model.pkl', 'rb') as f:
9
+ model = pickle.load(f)
10
+
11
+ # Create input fields
12
+ age = st.number_input("Enter age:", min_value=0)
13
+ sex = st.radio("Select sex:", ("FEMALE", "MALE"))
14
+ present_city = st.radio("Select present city:", ("Bengaluru City", "Other"))
15
+ present_state = st.radio("Select present state:", ("Karnataka", "Other"))
16
+
17
+ # Convert inputs to model format
18
+ sex_female = 1 if sex == 'FEMALE' else 0
19
+ sex_male = 1 if sex == 'MALE' else 0
20
+ city_bengaluru = 1 if present_city == 'Bengaluru City' else 0
21
+ state_karnataka = 1 if present_state == 'Karnataka' else 0
22
+
23
+ # Create a data frame for the input data
24
+ input_data = pd.DataFrame({
25
+ 'age': [age],
26
+ 'Sex_FEMALE': [sex_female],
27
+ 'Sex_MALE': [sex_male],
28
+ 'PresentCity_Bengaluru City': [city_bengaluru],
29
+ 'PresentState_Karnataka': [state_karnataka]
30
+ })
31
+
32
+ # Make a prediction
33
+ if st.button("Predict Behavioral Status"):
34
+ prediction = model.predict(input_data)
35
+ st.write(f"The predicted Behavioral Status is: {prediction[0]}")
36
+