princeml commited on
Commit
5e26834
·
1 Parent(s): de8a469

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +62 -39
app.py CHANGED
@@ -3,52 +3,52 @@ import joblib
3
  import numpy as np
4
 
5
 
6
- # load model
7
- loaded_model = joblib.load('model.pkl')
8
 
9
 
10
- def generate_prediction(input_array):
11
- ans = loaded_model.predict(input_array)
12
 
13
- return ans
14
 
15
 
16
- def main():
17
- # Face Analysis Application #
18
- st.title(" Face Emotion Detection Application")
19
- activiteis = ["Home", "Webcam Face Detection", "By Images","About"]
20
- choice = st.sidebar.selectbox("Select Activity", activiteis)
21
 
22
- if choice == "Home":
23
- html_temp_home1 = """<div style="background-color:#6D7B8D;padding:10px">
24
- <h3 style="color:yellow;text-align:center;"> Welcome to world of AI with Prince </h3>
25
- <h4 style="color:white;text-align:center;">
26
- Face Emotion detection application using OpenCV, Custom CNN model and Streamlit.</h4>
27
- </div>
28
- </br>"""
29
- st.markdown(html_temp_home1, unsafe_allow_html=True)
30
- st.write("""
31
- Real time face emotion recognization just by one click.
32
-
33
- """)
34
- if choice == "Webcam Face Detection":
35
- age = st.number_input("Enter your age")
36
- income = st.number_input("Monthly Income: ")
37
- family_size = st.number_input("Family Size:")
38
- pin = st.number_input("Pin Code: ")
39
 
40
- options = {"Positive": 1, "Negative": 0}
41
- selected_options = st.multiselect("Select persons:", list(options.keys()))
42
- selected_values = [options[option] for option in selected_options
43
- # st.write("Selected values:", selected_values)
44
- # default = [1,0]
45
- # Review = st.multiselect("Select options", options, default)
46
 
47
- # options_gender = ["Male", "Female"]
48
- # values_gender = [1, 0]
49
- # Review = st.multiselect("Select options", options_gender, values_gender)
50
 
51
- # gender = st.selectbox("Select your city", ,[1,0])
52
  # Marital_status = st.selectbox("Marital Status of the Customer", ["Single", "Married", "Not Revealed"],[1,2,3])
53
  # Occupation = st.selectbox("Occupation of the Customer", ["Student", "Employee", "Self Employeed", "House wife"],[1,2,3,4])
54
  # Educational = st.selectbox("Educational Qualification", ["Graduate", "Post Graduate" "Ph.D", "School", "Uneducated"],[1,2,3,4,5])
@@ -106,5 +106,28 @@ def main():
106
  # pass
107
 
108
 
109
- if __name__ == "__main__":
110
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  import numpy as np
4
 
5
 
6
+ # # load model
7
+ # loaded_model = joblib.load('model.pkl')
8
 
9
 
10
+ # def generate_prediction(input_array):
11
+ # ans = loaded_model.predict(input_array)
12
 
13
+ # return ans
14
 
15
 
16
+ # def main():
17
+ # # Face Analysis Application #
18
+ # st.title(" Face Emotion Detection Application")
19
+ # activiteis = ["Home", "Webcam Face Detection", "By Images","About"]
20
+ # choice = st.sidebar.selectbox("Select Activity", activiteis)
21
 
22
+ # if choice == "Home":
23
+ # html_temp_home1 = """<div style="background-color:#6D7B8D;padding:10px">
24
+ # <h3 style="color:yellow;text-align:center;"> Welcome to world of AI with Prince </h3>
25
+ # <h4 style="color:white;text-align:center;">
26
+ # Face Emotion detection application using OpenCV, Custom CNN model and Streamlit.</h4>
27
+ # </div>
28
+ # </br>"""
29
+ # st.markdown(html_temp_home1, unsafe_allow_html=True)
30
+ # st.write("""
31
+ # Real time face emotion recognization just by one click.
32
+
33
+ # """)
34
+ # if choice == "Webcam Face Detection":
35
+ # age = st.number_input("Enter your age")
36
+ # income = st.number_input("Monthly Income: ")
37
+ # family_size = st.number_input("Family Size:")
38
+ # pin = st.number_input("Pin Code: ")
39
 
40
+ # options = {"Positive": 1, "Negative": 0}
41
+ # selected_options = st.multiselect("Select persons:", list(options.keys()))
42
+ # selected_values = [options[option] for option in selected_options
43
+ # # st.write("Selected values:", selected_values)
44
+ # # default = [1,0]
45
+ # # Review = st.multiselect("Select options", options, default)
46
 
47
+ # # options_gender = ["Male", "Female"]
48
+ # # values_gender = [1, 0]
49
+ # # Review = st.multiselect("Select options", options_gender, values_gender)
50
 
51
+ # # gender = st.selectbox("Select your city", ,[1,0])
52
  # Marital_status = st.selectbox("Marital Status of the Customer", ["Single", "Married", "Not Revealed"],[1,2,3])
53
  # Occupation = st.selectbox("Occupation of the Customer", ["Student", "Employee", "Self Employeed", "House wife"],[1,2,3,4])
54
  # Educational = st.selectbox("Educational Qualification", ["Graduate", "Post Graduate" "Ph.D", "School", "Uneducated"],[1,2,3,4,5])
 
106
  # pass
107
 
108
 
109
+ # if __name__ == "__main__":
110
+ # main()
111
+
112
+
113
+
114
+ import streamlit as st
115
+
116
+ # Define the input fields
117
+ age = st.number_input("Age", min_value=0, max_value=120, value=30, step=1)
118
+ income = st.number_input("Income", min_value=0, max_value=1000000, value=50000, step=1000)
119
+ family_size = st.number_input("Family Size", min_value=1, max_value=10, value=4, step=1)
120
+ pin = st.number_input("Pin", min_value=100000, max_value=999999, value=500000, step=1)
121
+
122
+ gender = st.selectbox("Gender", [1, 2, 3])
123
+ marital_status = st.selectbox("Marital Status", [1, 2, 3])
124
+ occupation = st.selectbox("Occupation", [1, 2, 3])
125
+ educational_level = st.selectbox("Educational Level", [1, 2, 3])
126
+
127
+ # # Create a button to trigger the model
128
+ # if st.button("Predict"):
129
+ # # TODO: Replace with your model code
130
+ # prediction = "Some prediction"
131
+
132
+ # # Show the prediction
133
+ # st.write("Prediction:", prediction)