Commit 26949ed5 authored by Pasindu-Vimukthi's avatar Pasindu-Vimukthi

Model

parent 3d9fcf42
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Timestamp</th>\n",
" <th>perfercol</th>\n",
" <th>ColorScore</th>\n",
" <th>select_Preson</th>\n",
" <th>value</th>\n",
" <th>finalpresentage</th>\n",
" <th>level</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2021/07/07 10:37:09 pm GMT+5:30</td>\n",
" <td>Purple</td>\n",
" <td>2</td>\n",
" <td>Marilyn Monroe;Jack Ma;Mahathma Gandhi</td>\n",
" <td>3</td>\n",
" <td>27.777778</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2021/07/07 10:38:20 pm GMT+5:30</td>\n",
" <td>Dark Blue</td>\n",
" <td>3</td>\n",
" <td>Sharuk Khan;Sushant Singh Rajput;Gotabaya Raja...</td>\n",
" <td>4</td>\n",
" <td>38.888889</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2021/07/07 10:38:34 pm GMT+5:30</td>\n",
" <td>Light Blue</td>\n",
" <td>4</td>\n",
" <td>Idi Amin;Gotabaya Rajapaksha;Kusal Mendis</td>\n",
" <td>4</td>\n",
" <td>44.444444</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>2021/07/07 10:40:18 pm GMT+5:30</td>\n",
" <td>Dark Blue</td>\n",
" <td>3</td>\n",
" <td>Mark Zuckerberg;Adolf Hitler;Kusal Mendis</td>\n",
" <td>3</td>\n",
" <td>33.333333</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2021/07/07 10:45:38 pm GMT+5:30</td>\n",
" <td>Brown</td>\n",
" <td>2</td>\n",
" <td>Sushant Singh Rajput;Gotabaya Rajapaksha;Jack Ma</td>\n",
" <td>4</td>\n",
" <td>33.333333</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>199</th>\n",
" <td>2021/07/08 8:16:08 am GMT+5:30</td>\n",
" <td>Brown</td>\n",
" <td>2</td>\n",
" <td>Malala Yousafzai;Jack Ma;Sakvithi Ranasinghe</td>\n",
" <td>1</td>\n",
" <td>16.666667</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>200</th>\n",
" <td>2021/07/08 8:50:37 am GMT+5:30</td>\n",
" <td>Black</td>\n",
" <td>6</td>\n",
" <td>Sushant Singh Rajput;Mark Zuckerberg;Mahathma ...</td>\n",
" <td>3</td>\n",
" <td>50.000000</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>201</th>\n",
" <td>2021/07/08 10:49:08 am GMT+5:30</td>\n",
" <td>Dark Blue</td>\n",
" <td>3</td>\n",
" <td>Sushant Singh Rajput</td>\n",
" <td>3</td>\n",
" <td>33.333333</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>202</th>\n",
" <td>2021/07/08 11:55:09 am GMT+5:30</td>\n",
" <td>Dark Blue</td>\n",
" <td>3</td>\n",
" <td>Sharuk Khan;Mahathma Gandhi;Mark Zuckerberg</td>\n",
" <td>0</td>\n",
" <td>16.666667</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>203</th>\n",
" <td>2021/07/08 6:19:14 pm GMT+5:30</td>\n",
" <td>Light Blue</td>\n",
" <td>4</td>\n",
" <td>Nelson Mandela;Kusal Mendis;Mahathma Gandhi</td>\n",
" <td>1</td>\n",
" <td>27.777778</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>204 rows × 7 columns</p>\n",
"</div>"
],
"text/plain": [
" Timestamp perfercol ColorScore \\\n",
"0 2021/07/07 10:37:09 pm GMT+5:30 Purple 2 \n",
"1 2021/07/07 10:38:20 pm GMT+5:30 Dark Blue 3 \n",
"2 2021/07/07 10:38:34 pm GMT+5:30 Light Blue 4 \n",
"3 2021/07/07 10:40:18 pm GMT+5:30 Dark Blue 3 \n",
"4 2021/07/07 10:45:38 pm GMT+5:30 Brown 2 \n",
".. ... ... ... \n",
"199 2021/07/08 8:16:08 am GMT+5:30 Brown 2 \n",
"200 2021/07/08 8:50:37 am GMT+5:30 Black 6 \n",
"201 2021/07/08 10:49:08 am GMT+5:30 Dark Blue 3 \n",
"202 2021/07/08 11:55:09 am GMT+5:30 Dark Blue 3 \n",
"203 2021/07/08 6:19:14 pm GMT+5:30 Light Blue 4 \n",
"\n",
" select_Preson value \\\n",
"0 Marilyn Monroe;Jack Ma;Mahathma Gandhi 3 \n",
"1 Sharuk Khan;Sushant Singh Rajput;Gotabaya Raja... 4 \n",
"2 Idi Amin;Gotabaya Rajapaksha;Kusal Mendis 4 \n",
"3 Mark Zuckerberg;Adolf Hitler;Kusal Mendis 3 \n",
"4 Sushant Singh Rajput;Gotabaya Rajapaksha;Jack Ma 4 \n",
".. ... ... \n",
"199 Malala Yousafzai;Jack Ma;Sakvithi Ranasinghe 1 \n",
"200 Sushant Singh Rajput;Mark Zuckerberg;Mahathma ... 3 \n",
"201 Sushant Singh Rajput 3 \n",
"202 Sharuk Khan;Mahathma Gandhi;Mark Zuckerberg 0 \n",
"203 Nelson Mandela;Kusal Mendis;Mahathma Gandhi 1 \n",
"\n",
" finalpresentage level \n",
"0 27.777778 1 \n",
"1 38.888889 1 \n",
"2 44.444444 1 \n",
"3 33.333333 1 \n",
"4 33.333333 1 \n",
".. ... ... \n",
"199 16.666667 0 \n",
"200 50.000000 2 \n",
"201 33.333333 1 \n",
"202 16.666667 0 \n",
"203 27.777778 1 \n",
"\n",
"[204 rows x 7 columns]"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"df = pd.read_csv('pasindu.csv')\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>ColorScore</th>\n",
" <th>value</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>4</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>199</th>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>200</th>\n",
" <td>6</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>201</th>\n",
" <td>3</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>202</th>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>203</th>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>204 rows × 2 columns</p>\n",
"</div>"
],
"text/plain": [
" ColorScore value\n",
"0 2 3\n",
"1 3 4\n",
"2 4 4\n",
"3 3 3\n",
"4 2 4\n",
".. ... ...\n",
"199 2 1\n",
"200 6 3\n",
"201 3 3\n",
"202 3 0\n",
"203 4 1\n",
"\n",
"[204 rows x 2 columns]"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X = df.drop(columns = ['Timestamp','perfercol','select_Preson','finalpresentage','level'])\n",
"X"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/plain": [
"0 1\n",
"1 1\n",
"2 1\n",
"3 1\n",
"4 1\n",
" ..\n",
"199 0\n",
"200 2\n",
"201 1\n",
"202 0\n",
"203 1\n",
"Name: level, Length: 204, dtype: int64"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Y = df['level']\n",
"Y"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([2], dtype=int64)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"from sklearn.linear_model import LogisticRegression\n",
"model = LogisticRegression(max_iter=1000)\n",
"model.fit(X, Y)\n",
"prediction = model.predict([[2,7]])\n",
"prediction"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.975609756097561"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Check accuracy of the prediction according to the algorithm\n",
"import pandas as pd\n",
"from sklearn.linear_model import LogisticRegression\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.metrics import accuracy_score\n",
"\n",
"data = pd.read_csv('pasindu.csv')\n",
"X = df.drop(columns = ['Timestamp','perfercol','select_Preson','finalpresentage','level'])\n",
"Y = df['level']\n",
"\n",
"#20% of data ramdomly select for the testing\n",
"X_train, X_test, y_train, y_test = train_test_split(X, Y , test_size = 0.2)\n",
"model = LogisticRegression()\n",
"model.fit(X_train, y_train)\n",
"\n",
"prediction = model.predict(X_test)\n",
"score = accuracy_score(y_test, prediction)\n",
"score"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "b95bcb5e",
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"import pandas as pd\n",
"import numpy as np\n",
"def predict(colour,select_person,react,select_image,sleeping_hours): \n",
" load_model=pickle.load(open(\"best_model.sav\", 'rb'))\n",
" in_X=pd.read_csv('in_X.csv')\n",
" col_list=['Purple', 'Dark Blue', 'Light Blue', 'Brown', 'Black', 'Green','Yellow', 'Orange', 'Grey']\n",
" react_list=['happy','mid happy','un happy','low sad','angry','sad']\n",
" selimg_list=['angry image','happy image','proud image','sad image','suicide image']\n",
" in_X['perfercol_'+col_list[colour]]=1\n",
" in_X['react_'+react_list[react]]=1\n",
" in_X['sel_image_'+selimg_list[select_image]]=1\n",
" in_X['sleeping hours']=sleeping_hours/12\n",
" for i in range(3):\n",
" in_X['person_category'+str(select_person[i]+1)]=in_X['person_category'+str(select_person[i]+1)]+1\n",
" y_pred=load_model.predict(in_X)\n",
" return(y_pred[0])"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "9c468731",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(colour=4,select_person=(0,1,1),react=1,select_image=2,sleeping_hours=10)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "a6842280",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(colour=4,select_person=(3,3,3),react=0,select_image=1,sleeping_hours=10)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "4d5f185a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(colour=5,select_person=(0,0,0),react=0,select_image=2,sleeping_hours=6)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a6862609",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cells": [
{
"cell_type": "code",
"execution_count": 13,
"id": "b95bcb5e",
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"def predict(colour,select_person1,select_person2,select_person3,react,select_image,sleeping_hours): \n",
" load_model=pickle.load(open(\"best_model.sav\", 'rb'))\n",
" in_X=pd.read_csv('in_X.csv')\n",
" select_person=(select_person1,select_person2,select_person3)\n",
" col_list=['Purple', 'Dark Blue', 'Light Blue', 'Brown', 'Black', 'Green','Yellow', 'Orange', 'Grey']\n",
" react_list=['happy','mid happy','un happy','low sad','angry','sad']\n",
" selimg_list=['angry image','happy image','proud image','sad image','suicide image']\n",
" in_X['perfercol_'+col_list[colour]]=1\n",
" in_X['react_'+react_list[react]]=1\n",
" in_X['sel_image_'+selimg_list[select_image]]=1\n",
" in_X['sleeping hours']=sleeping_hours/12\n",
" for i in range(3):\n",
" in_X['person_category'+str(select_person[i]+1)]=in_X['person_category'+str(select_person[i]+1)]+1\n",
" y_pred=load_model.predict(in_X)\n",
" return(y_pred[0])"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "9c468731",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(4,0,1,1,1,2,10)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "a6842280",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(4,3,3,3,0,1,10)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "4d5f185a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(5,0,0,0,0,2,6)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "a6862609",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(7,0,0,0,0,2,6)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "1e3c521a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(5,3,3,3,5,4,6)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "42974f85",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: flask-ngrok in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (0.0.25)\n",
"Requirement already satisfied: requests in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from flask-ngrok) (2.26.0)\n",
"Requirement already satisfied: Flask>=0.8 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from flask-ngrok) (2.0.2)\n",
"Requirement already satisfied: itsdangerous>=2.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Flask>=0.8->flask-ngrok) (2.0.1)\n",
"Requirement already satisfied: Werkzeug>=2.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Flask>=0.8->flask-ngrok) (2.0.2)\n",
"Requirement already satisfied: Jinja2>=3.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Flask>=0.8->flask-ngrok) (3.0.2)\n",
"Requirement already satisfied: click>=7.1.2 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Flask>=0.8->flask-ngrok) (8.0.3)\n",
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->flask-ngrok) (2021.10.8)\n",
"Requirement already satisfied: charset-normalizer~=2.0.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->flask-ngrok) (2.0.7)\n",
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->flask-ngrok) (1.26.7)\n",
"Requirement already satisfied: idna<4,>=2.5 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->flask-ngrok) (3.2)\n",
"Requirement already satisfied: colorama in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from click>=7.1.2->Flask>=0.8->flask-ngrok) (0.4.4)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Jinja2>=3.0->Flask>=0.8->flask-ngrok) (2.0.1)\n"
]
}
],
"source": [
"!pip install flask-ngrok"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "7c0caa04",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * Serving Flask app '__main__' (lazy loading)\n",
" * Environment: production\n",
"\u001b[31m WARNING: This is a development server. Do not use it in a production deployment.\u001b[0m\n",
"\u001b[2m Use a production WSGI server instead.\u001b[0m\n",
" * Debug mode: off\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n",
"Exception in thread Thread-8:\n",
"Traceback (most recent call last):\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\threading.py\", line 973, in _bootstrap_inner\n",
" self.run()\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\threading.py\", line 1286, in run\n",
" self.function(*self.args, **self.kwargs)\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\flask_ngrok.py\", line 70, in start_ngrok\n",
" ngrok_address = _run_ngrok()\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\flask_ngrok.py\", line 31, in _run_ngrok\n",
" ngrok = subprocess.Popen([executable, 'http', '5000'])\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\subprocess.py\", line 951, in __init__\n",
" self._execute_child(args, executable, preexec_fn, close_fds,\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\subprocess.py\", line 1420, in _execute_child\n",
" hp, ht, pid, tid = _winapi.CreateProcess(executable, args,\n",
"OSError: [WinError 193] %1 is not a valid Win32 application\n"
]
}
],
"source": [
"\n",
"from flask_ngrok import run_with_ngrok\n",
"\n",
"from flask import Flask,jsonify\n",
"app=Flask(__name__)\n",
"run_with_ngrok(app) #starts ngrok when the app is running\n",
"@app.route(\"/<int:color>/<int:person1>/<int:person2>/<int:person3>/<int:react>/<int:image>/<int:sleepingH>\")\n",
"def home(color,person1,person2,person3,react,image,sleepingH):\n",
" p = []\n",
" p +=[color,person1,person2,person3,react,image,sleepingH]\n",
"\n",
" \n",
" \n",
" arr = np.array([p])\n",
" predict =predict(arr)\n",
" if predict == [0]:\n",
" result = \"normal\"\n",
" elif predict == [1]:\n",
" result = \"mid mod\" \n",
" elif predict == [2]:\n",
" result = \"Severe\"\n",
" else:\n",
" result = \"extreame\"\n",
"\n",
" return jsonify(result)\n",
"app.run()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1d4524e2",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
This source diff could not be displayed because it is too large. You can view the blob instead.
Timestamp,Age,gender,perfercol,select_Preson,react,sel_image,sleeping hours,level
2021/07/07 10:37:09 pm GMT+5:30,41,0,Purple,Marilyn Monroe;Jack Ma;Mahathma Gandhi,happy,proud image,7,1
2021/07/07 10:38:20 pm GMT+5:30,50,0,Dark Blue,Sharuk Khan;Sushant Singh Rajput;Gotabaya Rajapaksha,happy,sad image,7,1
2021/07/07 10:38:34 pm GMT+5:30,25,0,Light Blue,Idi Amin;Gotabaya Rajapaksha;Kusal Mendis,happy,proud image,8,1
2021/07/07 10:40:18 pm GMT+5:30,43,0,Dark Blue,Mark Zuckerberg;Adolf Hitler;Kusal Mendis,un happy,proud image,7,1
2021/07/07 10:45:38 pm GMT+5:30,40,0,Brown,Sushant Singh Rajput;Gotabaya Rajapaksha;Jack Ma,un happy,proud image,7,1
2021/07/07 10:45:52 pm GMT+5:30,35,1,Black,Mahathma Gandhi;Sharuk Khan;Nelson Mandela,low sad,proud image,7,1
2021/07/07 10:45:56 pm GMT+5:30,21,1,Green,Nelson Mandela;Sushant Singh Rajput;Mark Zuckerberg,happy,proud image,6,0
2021/07/07 10:46:12 pm GMT+5:30,20,0,Yellow,Osama-bin-Laden;Idi Amin;Adolf Hitler,happy,angry image,3,2
2021/07/07 10:47:51 pm GMT+5:30,24,0,Purple,Osama-bin-Laden;Adolf Hitler;Mark Zuckerberg,mid happy,proud image,7,1
2021/07/07 10:54:13 pm GMT+5:30,20,1,Yellow,Marilyn Monroe;Gotabaya Rajapaksha;Osama-bin-Laden,happy,angry image,3,2
2021/07/07 11:09:13 pm GMT+5:30,48,1,Black,Sharuk Khan;Dasun Nishan;Sushant Singh Rajput,happy,happy image,4,2
2021/07/07 11:55:45 pm GMT+5:30,46,0,Purple,Kusal Mendis;Sushant Singh Rajput;Jack Ma;Dasun Nishan;Sakvithi Ranasinghe,happy,sad image,7,1
2021/07/07 11:56:10 pm GMT+5:30,24,1,Purple,Idi Amin;Nelson Mandela;Sushant Singh Rajput,happy,sad image,7,1
2021/07/07 11:56:24 pm GMT+5:30,24,1,Orange,Marilyn Monroe;Adolf Hitler;Dasun Nishan,happy,happy image,4,2
2021/07/07 11:56:36 pm GMT+5:30,47,0,Dark Blue,Jack Ma;Kusal Mendis;Dasun Nishan,happy,sad image,8,1
2021/07/07 11:57:00 pm GMT+5:30,50,0,Yellow,Mark Zuckerberg;Jack Ma;Kusal Mendis,happy,happy image,8,0
2021/07/07 11:57:22 pm GMT+5:30,30,1,Purple,Mark Zuckerberg;Nelson Mandela;Adolf Hitler,low sad,happy image,7,0
2021/07/07 11:57:46 pm GMT+5:30,22,1,Yellow,Mark Zuckerberg;Adolf Hitler;Osama-bin-Laden,low sad,proud image,6,1
2021/07/07 11:58:14 pm GMT+5:30,42,0,Grey,Osama-bin-Laden;Sushant Singh Rajput;Gotabaya Rajapaksha,mid happy,happy image,12,3
2021/07/07 11:58:31 pm GMT+5:30,30,1,Green,Gotabaya Rajapaksha;Mahathma Gandhi;Malala Yousafzai,happy,happy image,7,0
2021/07/07 11:58:45 pm GMT+5:30,23,1,Orange,Mark Zuckerberg;Sakvithi Ranasinghe;Adolf Hitler,mid happy,proud image,9,1
2021/07/07 11:58:56 pm GMT+5:30,40,0,Dark Blue,Osama-bin-Laden;Mark Zuckerberg;Adolf Hitler,happy,proud image,7,1
2021/07/07 11:59:46 pm GMT+5:30,36,0,Light Blue,Nelson Mandela;Mahathma Gandhi;Osama-bin-Laden,happy,proud image,7,1
2021/07/08 12:00:04 am GMT+5:30,42,1,Grey,Marilyn Monroe;Adolf Hitler;Idi Amin,mid happy,suicide image,11,3
2021/07/08 12:00:20 am GMT+5:30,37,0,Grey,Jack Ma;Mark Zuckerberg;Kusal Mendis,mid happy,happy image,4,2
2021/07/08 12:01:00 am GMT+5:30,28,1,Brown,Mahathma Gandhi;Gotabaya Rajapaksha;Jack Ma;Sushant Singh Rajput,mid happy,happy image,9,0
2021/07/08 12:01:12 am GMT+5:30,18,0,Orange,Kusal Mendis;Nelson Mandela;Jack Ma,mid happy,proud image,8,0
2021/07/08 12:21:03 am GMT+5:30,50,0,Purple,Malala Yousafzai,low sad,happy image,8,0
2021/07/08 12:39:33 am GMT+5:30,21,0,Dark Blue,Nelson Mandela;Sakvithi Ranasinghe;Adolf Hitler,mid happy,proud image,8,1
2021/07/08 12:40:11 am GMT+5:30,33,0,Dark Blue,Sushant Singh Rajput;Nelson Mandela;Mahathma Gandhi,mid happy,proud image,8,1
2021/07/08 12:40:26 am GMT+5:30,37,0,Dark Blue,Sushant Singh Rajput;Sharuk Khan;Jack Ma,angry,proud image,7,1
2021/07/08 12:40:53 am GMT+5:30,21,0,Orange,Marilyn Monroe;Jack Ma;Malala Yousafzai,mid happy,proud image,9,1
2021/07/08 12:41:04 am GMT+5:30,32,0,Purple,Adolf Hitler;Jack Ma;Mark Zuckerberg,mid happy,happy image,7,0
2021/07/08 12:41:19 am GMT+5:30,27,0,Grey,Kusal Mendis;Sushant Singh Rajput;Osama-bin-Laden,mid happy,happy image,11,3
2021/07/08 12:41:36 am GMT+5:30,45,0,Green,Kusal Mendis;Gotabaya Rajapaksha,mid happy,happy image,7,0
2021/07/08 12:41:52 am GMT+5:30,34,0,Black,Dasun Nishan;Sakvithi Ranasinghe,un happy,proud image,11,3
2021/07/08 12:42:04 am GMT+5:30,20,1,Yellow,Adolf Hitler;Kusal Mendis;Osama-bin-Laden,happy,proud image,7,1
2021/07/08 12:42:14 am GMT+5:30,41,0,Purple,Marilyn Monroe;Nelson Mandela;Sushant Singh Rajput,un happy,proud image,7,1
2021/07/08 12:42:25 am GMT+5:30,44,1,Purple,Nelson Mandela;Kusal Mendis;Sushant Singh Rajput,mid happy,proud image,6,1
2021/07/08 12:42:36 am GMT+5:30,36,1,Grey,Nelson Mandela;Sakvithi Ranasinghe;Mahathma Gandhi,low sad,happy image,5,2
2021/07/08 12:59:50 am GMT+5:30,23,0,Black,Osama-bin-Laden;Adolf Hitler;Gotabaya Rajapaksha,happy,angry image,5,2
2021/07/08 7:07:22 am GMT+5:30,40,0,Yellow,Jack Ma;Sharuk Khan;Mark Zuckerberg,un happy,happy image,6,0
2021/07/08 7:07:35 am GMT+5:30,30,1,Orange,Dasun Nishan;Sakvithi Ranasinghe;Sushant Singh Rajput,mid happy,happy image,5,2
2021/07/08 7:07:51 am GMT+5:30,46,0,Light Blue,Jack Ma;Osama-bin-Laden;Dasun Nishan,low sad,happy image,5,2
2021/07/08 7:08:13 am GMT+5:30,28,0,Black,Osama-bin-Laden;Adolf Hitler;Marilyn Monroe,mid happy,happy image,4,2
2021/07/08 7:08:27 am GMT+5:30,43,1,Purple,Osama-bin-Laden;Mahathma Gandhi;Kusal Mendis;Mark Zuckerberg,mid happy,sad image,6,1
2021/07/08 7:08:40 am GMT+5:30,41,0,Purple,Mahathma Gandhi;Nelson Mandela;Sushant Singh Rajput,mid happy,proud image,8,1
2021/07/08 7:08:52 am GMT+5:30,30,1,Orange,Mahathma Gandhi;Jack Ma;Kusal Mendis,mid happy,proud image,7,0
2021/07/08 7:09:05 am GMT+5:30,23,0,Light Blue,Malala Yousafzai;Marilyn Monroe;Gotabaya Rajapaksha,un happy,proud image,9,1
2021/07/08 7:09:23 am GMT+5:30,46,1,Green,Osama-bin-Laden;Mahathma Gandhi;Idi Amin,un happy,proud image,6,1
2021/07/08 7:15:29 am GMT+5:30,19,0,Light Blue,Mahathma Gandhi;Sharuk Khan;Nelson Mandela,un happy,proud image,9,0
2021/07/08 7:17:43 am GMT+5:30,26,1,Grey,Adolf Hitler;Sakvithi Ranasinghe;Sushant Singh Rajput,happy,happy image,4,3
2021/07/08 7:17:57 am GMT+5:30,41,1,Yellow,Gotabaya Rajapaksha;Sakvithi Ranasinghe;Osama-bin-Laden,happy,proud image,7,1
2021/07/08 7:18:14 am GMT+5:30,34,0,Dark Blue,Nelson Mandela;Malala Yousafzai;Marilyn Monroe;Dasun Nishan,mid happy,proud image,8,1
2021/07/08 7:18:26 am GMT+5:30,44,1,Brown,Mahathma Gandhi;Dasun Nishan;Kusal Mendis,happy,proud image,7,1
2021/07/08 7:18:38 am GMT+5:30,48,1,Purple,Idi Amin;Gotabaya Rajapaksha;Mark Zuckerberg,low sad,proud image,7,1
2021/07/08 7:18:54 am GMT+5:30,18,1,Dark Blue,Sharuk Khan;Kusal Mendis;Dasun Nishan,mid happy,proud image,9,1
2021/07/08 7:25:22 am GMT+5:30,39,0,Light Blue,Sakvithi Ranasinghe;Gotabaya Rajapaksha;Adolf Hitler,low sad,proud image,8,1
2021/07/08 7:25:38 am GMT+5:30,38,1,Light Blue,Sharuk Khan;Jack Ma;Dasun Nishan,un happy,proud image,8,1
2021/07/08 7:25:53 am GMT+5:30,25,1,Orange,Dasun Nishan;Kusal Mendis;Osama-bin-Laden,happy,proud image,9,1
2021/07/08 7:26:06 am GMT+5:30,36,1,Brown,Sakvithi Ranasinghe;Jack Ma;Adolf Hitler,mid happy,proud image,8,1
2021/07/08 7:26:15 am GMT+5:30,38,1,Yellow,Adolf Hitler;Idi Amin;Dasun Nishan,happy,happy image,5,2
2021/07/08 7:26:26 am GMT+5:30,32,1,Brown,Mahathma Gandhi;Kusal Mendis;Jack Ma,happy,happy image,7,0
2021/07/08 7:26:37 am GMT+5:30,32,0,Orange,Nelson Mandela;Osama-bin-Laden;Kusal Mendis;Dasun Nishan,low sad,proud image,9,1
2021/07/08 7:26:52 am GMT+5:30,48,0,Brown,Sakvithi Ranasinghe;Jack Ma;Adolf Hitler,low sad,proud image,8,1
2021/07/08 7:27:20 am GMT+5:30,28,1,Brown,Sakvithi Ranasinghe;Gotabaya Rajapaksha;Nelson Mandela,mid happy,happy image,3,2
2021/07/08 7:27:33 am GMT+5:30,36,1,Brown,Sharuk Khan;Sushant Singh Rajput;Sakvithi Ranasinghe,low sad,proud image,7,1
2021/07/08 7:27:45 am GMT+5:30,18,1,Brown,Sharuk Khan;Idi Amin;Nelson Mandela,happy,happy image,6,0
2021/07/08 7:47:53 am GMT+5:30,47,0,Yellow,Nelson Mandela;Sakvithi Ranasinghe;Malala Yousafzai,happy,happy image,6,0
2021/07/08 7:48:07 am GMT+5:30,45,0,Purple,Mark Zuckerberg;Osama-bin-Laden;Sushant Singh Rajput,un happy,proud image,7,1
2021/07/08 7:48:20 am GMT+5:30,30,1,Dark Blue,Idi Amin;Dasun Nishan;Sushant Singh Rajput,low sad,happy image,3,2
2021/07/08 7:48:32 am GMT+5:30,25,0,Black,Marilyn Monroe;Dasun Nishan;Gotabaya Rajapaksha,happy,angry image,5,2
2021/07/08 7:48:52 am GMT+5:30,41,1,Purple,Sushant Singh Rajput;Malala Yousafzai;Sharuk Khan,un happy,proud image,9,1
2021/07/08 7:49:14 am GMT+5:30,46,0,Black,Idi Amin;Kusal Mendis;Marilyn Monroe,mid happy,happy image,3,2
2021/07/08 7:49:26 am GMT+5:30,37,0,Orange,Jack Ma;Sakvithi Ranasinghe;Dasun Nishan,happy,proud image,8,1
2021/07/08 7:49:40 am GMT+5:30,38,1,Green,Jack Ma;Sakvithi Ranasinghe;Osama-bin-Laden;Mark Zuckerberg,mid happy,proud image,8,0
2021/07/08 7:49:54 am GMT+5:30,39,0,Yellow,Malala Yousafzai;Idi Amin;Mahathma Gandhi,mid happy,happy image,6,0
2021/07/08 7:50:11 am GMT+5:30,22,0,Brown,Osama-bin-Laden;Idi Amin;Gotabaya Rajapaksha,mid happy,proud image,6,1
2021/07/08 7:50:27 am GMT+5:30,36,0,Brown,Marilyn Monroe;Idi Amin;Adolf Hitler,mid happy,happy image,4,2
2021/07/08 7:50:52 am GMT+5:30,43,0,Dark Blue,Gotabaya Rajapaksha;Dasun Nishan;Kusal Mendis,un happy,sad image,9,1
2021/07/08 7:51:08 am GMT+5:30,29,1,Dark Blue,Nelson Mandela;Jack Ma;Mahathma Gandhi,happy,proud image,9,0
2021/07/08 7:51:21 am GMT+5:30,36,1,Green,Gotabaya Rajapaksha;Jack Ma;Kusal Mendis,happy,happy image,6,0
2021/07/08 7:51:32 am GMT+5:30,19,0,Dark Blue,Marilyn Monroe;Malala Yousafzai;Sushant Singh Rajput,un happy,suicide image,3,2
2021/07/08 7:52:09 am GMT+5:30,50,0,Yellow,Osama-bin-Laden;Malala Yousafzai;Mahathma Gandhi,happy,proud image,9,0
2021/07/08 7:52:21 am GMT+5:30,25,0,Brown,Marilyn Monroe;Malala Yousafzai;Sakvithi Ranasinghe,happy,proud image,7,1
2021/07/08 7:52:32 am GMT+5:30,24,0,Black,Nelson Mandela;Gotabaya Rajapaksha;Jack Ma,un happy,proud image,9,1
2021/07/08 7:52:43 am GMT+5:30,38,1,Light Blue,Kusal Mendis;Sakvithi Ranasinghe;Mark Zuckerberg,low sad,proud image,9,1
2021/07/08 7:52:53 am GMT+5:30,40,1,Purple,Nelson Mandela;Sharuk Khan;Mahathma Gandhi,happy,happy image,9,0
2021/07/08 7:53:01 am GMT+5:30,33,1,Brown,Marilyn Monroe;Osama-bin-Laden;Malala Yousafzai,un happy,proud image,8,1
2021/07/08 7:53:19 am GMT+5:30,41,0,Light Blue,Osama-bin-Laden;Adolf Hitler;Nelson Mandela,un happy,proud image,8,1
2021/07/08 7:53:29 am GMT+5:30,25,1,Yellow,Kusal Mendis;Nelson Mandela;Mark Zuckerberg,mid happy,happy image,8,0
2021/07/08 7:53:40 am GMT+5:30,26,1,Purple,Dasun Nishan;Sushant Singh Rajput;Adolf Hitler,mid happy,suicide image,5,2
2021/07/08 7:53:52 am GMT+5:30,28,0,Black,Osama-bin-Laden;Nelson Mandela;Gotabaya Rajapaksha,mid happy,happy image,5,2
2021/07/08 7:54:03 am GMT+5:30,40,1,Dark Blue,Sakvithi Ranasinghe;Nelson Mandela;Osama-bin-Laden,mid happy,proud image,6,1
2021/07/08 7:54:12 am GMT+5:30,29,0,Orange,Gotabaya Rajapaksha;Kusal Mendis;Idi Amin,mid happy,proud image,9,1
2021/07/08 7:54:23 am GMT+5:30,38,0,Light Blue,Osama-bin-Laden;Jack Ma;Idi Amin,un happy,proud image,8,1
2021/07/08 7:54:32 am GMT+5:30,45,1,Grey,Adolf Hitler;Jack Ma;Osama-bin-Laden,mid happy,happy image,5,2
2021/07/08 7:54:43 am GMT+5:30,19,0,Dark Blue,Marilyn Monroe;Osama-bin-Laden;Sharuk Khan,happy,angry image,4,2
2021/07/08 7:54:51 am GMT+5:30,27,0,Brown,Osama-bin-Laden;Nelson Mandela;Mahathma Gandhi,mid happy,happy image,6,0
2021/07/08 7:55:03 am GMT+5:30,21,1,Dark Blue,Idi Amin;Osama-bin-Laden;Gotabaya Rajapaksha,mid happy,proud image,8,1
2021/07/08 7:55:42 am GMT+5:30,41,0,Brown,Jack Ma;Gotabaya Rajapaksha;Sakvithi Ranasinghe,happy,proud image,8,0
2021/07/08 7:56:10 am GMT+5:30,50,0,Black,Adolf Hitler;Malala Yousafzai;Idi Amin,mid happy,sad image,9,1
2021/07/08 7:56:22 am GMT+5:30,35,1,Yellow,Sushant Singh Rajput;Mark Zuckerberg;Kusal Mendis,mid happy,proud image,9,1
2021/07/08 7:56:38 am GMT+5:30,19,0,Purple,Sharuk Khan;Nelson Mandela;Adolf Hitler,happy,happy image,6,0
2021/07/08 7:56:48 am GMT+5:30,45,0,Purple,Marilyn Monroe;Osama-bin-Laden;Kusal Mendis,mid happy,proud image,8,1
2021/07/08 7:57:01 am GMT+5:30,30,0,Yellow,Dasun Nishan;Mark Zuckerberg;Adolf Hitler,mid happy,proud image,9,1
2021/07/08 7:57:12 am GMT+5:30,31,1,Grey,Dasun Nishan;Jack Ma;Sushant Singh Rajput,happy,happy image,4,3
2021/07/08 7:57:25 am GMT+5:30,28,1,Dark Blue,Marilyn Monroe;Mahathma Gandhi;Sharuk Khan;Adolf Hitler,happy,happy image,3,2
2021/07/08 7:57:33 am GMT+5:30,49,0,Yellow,Mahathma Gandhi;Jack Ma;Marilyn Monroe,happy,proud image,8,1
2021/07/08 7:57:41 am GMT+5:30,31,0,Brown,Adolf Hitler;Kusal Mendis;Mark Zuckerberg,mid happy,happy image,9,0
2021/07/08 7:58:00 am GMT+5:30,36,1,Dark Blue,Sharuk Khan;Sushant Singh Rajput;Marilyn Monroe,mid happy,suicide image,5,2
2021/07/08 7:58:11 am GMT+5:30,36,1,Dark Blue,Sharuk Khan;Mark Zuckerberg;Osama-bin-Laden,happy,proud image,7,1
2021/07/08 7:58:27 am GMT+5:30,49,0,Green,Sharuk Khan;Malala Yousafzai;Sushant Singh Rajput,happy,happy image,6,0
2021/07/08 7:58:37 am GMT+5:30,36,1,Orange,Mark Zuckerberg;Mahathma Gandhi;Jack Ma,low sad,happy image,7,0
2021/07/08 7:58:48 am GMT+5:30,25,1,Light Blue,Adolf Hitler;Mahathma Gandhi;Idi Amin,happy,proud image,7,1
2021/07/08 7:59:00 am GMT+5:30,24,1,Orange,Sakvithi Ranasinghe;Mark Zuckerberg;Kusal Mendis,mid happy,happy image,6,0
2021/07/08 7:59:10 am GMT+5:30,31,1,Yellow,Nelson Mandela;Mark Zuckerberg;Jack Ma,happy,happy image,8,0
2021/07/08 7:59:19 am GMT+5:30,48,0,Grey,Gotabaya Rajapaksha;Sakvithi Ranasinghe;Kusal Mendis,low sad,suicide image,3,2
2021/07/08 7:59:28 am GMT+5:30,46,0,Dark Blue,Malala Yousafzai;Marilyn Monroe;Kusal Mendis,un happy,proud image,6,1
2021/07/08 7:59:41 am GMT+5:30,20,0,Black,Jack Ma;Malala Yousafzai;Osama-bin-Laden,un happy,sad image,7,1
2021/07/08 7:59:53 am GMT+5:30,23,1,Yellow,Mark Zuckerberg;Adolf Hitler;Marilyn Monroe,mid happy,sad image,6,1
2021/07/08 8:00:05 am GMT+5:30,29,1,Grey,Malala Yousafzai;Sharuk Khan;Jack Ma,un happy,proud image,9,1
2021/07/08 8:00:17 am GMT+5:30,35,1,Dark Blue,Gotabaya Rajapaksha;Kusal Mendis;Mark Zuckerberg,happy,sad image,6,1
2021/07/08 8:00:25 am GMT+5:30,19,0,Brown,Dasun Nishan;Gotabaya Rajapaksha;Osama-bin-Laden,mid happy,proud image,9,1
2021/07/08 8:00:33 am GMT+5:30,30,1,Light Blue,Mahathma Gandhi;Jack Ma;Marilyn Monroe,happy,proud image,8,1
2021/07/08 8:00:44 am GMT+5:30,43,1,Black,Dasun Nishan;Marilyn Monroe;Adolf Hitler,mid happy,happy image,9,3
2021/07/08 8:00:53 am GMT+5:30,49,0,Orange,Gotabaya Rajapaksha;Adolf Hitler;Sakvithi Ranasinghe,un happy,proud image,8,1
2021/07/08 8:01:03 am GMT+5:30,43,0,Yellow,Kusal Mendis;Mark Zuckerberg;Mahathma Gandhi,low sad,happy image,6,0
2021/07/08 8:01:10 am GMT+5:30,39,0,Brown,Sushant Singh Rajput;Gotabaya Rajapaksha;Jack Ma,un happy,proud image,7,1
2021/07/08 8:01:20 am GMT+5:30,27,1,Purple,Malala Yousafzai;Jack Ma;Dasun Nishan,happy,proud image,6,1
2021/07/08 8:01:28 am GMT+5:30,27,1,Brown,Malala Yousafzai;Kusal Mendis;Dasun Nishan,mid happy,proud image,9,1
2021/07/08 8:01:36 am GMT+5:30,26,0,Brown,Idi Amin;Osama-bin-Laden;Nelson Mandela,happy,proud image,6,1
2021/07/08 8:01:45 am GMT+5:30,45,0,Brown,Gotabaya Rajapaksha;Marilyn Monroe;Sakvithi Ranasinghe,low sad,proud image,6,1
2021/07/08 8:01:56 am GMT+5:30,29,0,Purple,Sushant Singh Rajput;Osama-bin-Laden;Gotabaya Rajapaksha,low sad,proud image,8,1
2021/07/08 8:02:04 am GMT+5:30,30,1,Light Blue,Kusal Mendis;Malala Yousafzai;Jack Ma,un happy,proud image,7,1
2021/07/08 8:02:28 am GMT+5:30,18,1,Dark Blue,Nelson Mandela;Malala Yousafzai;Sushant Singh Rajput,happy,sad image,8,1
2021/07/08 8:02:37 am GMT+5:30,31,0,Yellow,Nelson Mandela;Adolf Hitler;Dasun Nishan,happy,proud image,8,1
2021/07/08 8:02:53 am GMT+5:30,24,1,Dark Blue,Malala Yousafzai;Idi Amin;Adolf Hitler,low sad,proud image,8,1
2021/07/08 8:03:36 am GMT+5:30,43,0,Yellow,Sakvithi Ranasinghe;Dasun Nishan;Sharuk Khan,happy,proud image,7,1
2021/07/08 8:03:45 am GMT+5:30,26,1,Brown,Dasun Nishan;Nelson Mandela;Idi Amin,low sad,proud image,6,1
2021/07/08 8:03:54 am GMT+5:30,38,1,Orange,Adolf Hitler;Gotabaya Rajapaksha;Sushant Singh Rajput,happy,sad image,6,1
2021/07/08 8:04:05 am GMT+5:30,41,0,Brown,Sushant Singh Rajput;Mahathma Gandhi;Dasun Nishan,happy,proud image,6,1
2021/07/08 8:04:13 am GMT+5:30,37,0,Brown,Idi Amin;Malala Yousafzai;Mark Zuckerberg,mid happy,happy image,9,0
2021/07/08 8:04:33 am GMT+5:30,43,0,Yellow,Sharuk Khan;Adolf Hitler;Nelson Mandela,low sad,happy image,6,0
2021/07/08 8:04:42 am GMT+5:30,23,0,Yellow,Marilyn Monroe;Kusal Mendis;Dasun Nishan,un happy,happy image,5,2
2021/07/08 8:04:53 am GMT+5:30,18,0,Purple,Mark Zuckerberg;Adolf Hitler;Kusal Mendis,mid happy,proud image,6,1
2021/07/08 8:05:17 am GMT+5:30,20,1,Light Blue,Nelson Mandela;Adolf Hitler;Kusal Mendis,happy,proud image,7,1
2021/07/08 8:05:26 am GMT+5:30,43,0,Brown,Jack Ma;Sushant Singh Rajput;Mark Zuckerberg,mid happy,sad image,9,1
2021/07/08 8:05:36 am GMT+5:30,49,0,Black,Sharuk Khan;Mahathma Gandhi;Marilyn Monroe,happy,proud image,6,1
2021/07/08 8:05:47 am GMT+5:30,25,0,Purple,Nelson Mandela;Osama-bin-Laden;Marilyn Monroe,happy,proud image,6,1
2021/07/08 8:05:57 am GMT+5:30,30,0,Orange,Malala Yousafzai;Mark Zuckerberg;Nelson Mandela,happy,happy image,8,0
2021/07/08 8:06:11 am GMT+5:30,44,0,Purple,Mark Zuckerberg;Osama-bin-Laden;Dasun Nishan,happy,proud image,9,1
2021/07/08 8:06:19 am GMT+5:30,41,1,Brown,Jack Ma;Marilyn Monroe;Sakvithi Ranasinghe,happy,sad image,9,1
2021/07/08 8:06:29 am GMT+5:30,50,0,Brown,Nelson Mandela;Sushant Singh Rajput,low sad,proud image,7,1
2021/07/08 8:06:38 am GMT+5:30,49,1,Black,Mahathma Gandhi;Dasun Nishan;Mark Zuckerberg,mid happy,happy image,3,2
2021/07/08 8:06:48 am GMT+5:30,21,0,Orange,Jack Ma;Sakvithi Ranasinghe;Malala Yousafzai,mid happy,happy image,9,0
2021/07/08 8:07:01 am GMT+5:30,19,0,Grey,Sharuk Khan;Mahathma Gandhi;Marilyn Monroe,happy,happy image,3,2
2021/07/08 8:07:11 am GMT+5:30,25,1,Orange,Sakvithi Ranasinghe;Nelson Mandela;Jack Ma,mid happy,happy image,7,0
2021/07/08 8:07:32 am GMT+5:30,41,0,Yellow,Sushant Singh Rajput;Mark Zuckerberg;Sakvithi Ranasinghe,sad,proud image,7,1
2021/07/08 8:07:40 am GMT+5:30,39,1,Purple,Sushant Singh Rajput;Mark Zuckerberg;Jack Ma,mid happy,proud image,6,1
2021/07/08 8:07:49 am GMT+5:30,23,0,Dark Blue,Idi Amin;Sakvithi Ranasinghe;Marilyn Monroe,mid happy,happy image,4,2
2021/07/08 8:07:57 am GMT+5:30,42,1,Dark Blue,Sakvithi Ranasinghe;Mark Zuckerberg;Kusal Mendis,happy,proud image,8,1
2021/07/08 8:08:08 am GMT+5:30,40,0,Purple,Malala Yousafzai;Marilyn Monroe;Gotabaya Rajapaksha,mid happy,proud image,9,1
2021/07/08 8:08:32 am GMT+5:30,23,0,Dark Blue,Nelson Mandela;Gotabaya Rajapaksha;Sakvithi Ranasinghe,happy,sad image,6,1
2021/07/08 8:08:47 am GMT+5:30,37,1,Yellow,Sharuk Khan;Idi Amin;Jack Ma,mid happy,happy image,9,0
2021/07/08 8:08:56 am GMT+5:30,36,0,Orange,Jack Ma;Mark Zuckerberg;Malala Yousafzai,happy,happy image,7,0
2021/07/08 8:09:06 am GMT+5:30,49,1,Brown,Sharuk Khan;Marilyn Monroe;Sakvithi Ranasinghe,un happy,proud image,7,1
2021/07/08 8:09:15 am GMT+5:30,43,1,Light Blue,Gotabaya Rajapaksha;Dasun Nishan;Sakvithi Ranasinghe,mid happy,suicide image,5,2
2021/07/08 8:09:23 am GMT+5:30,18,1,Purple,Sushant Singh Rajput;Jack Ma;Mark Zuckerberg,angry,proud image,9,1
2021/07/08 8:09:33 am GMT+5:30,38,0,Dark Blue,Kusal Mendis;Sakvithi Ranasinghe;Adolf Hitler,happy,proud image,8,1
2021/07/08 8:09:41 am GMT+5:30,20,1,Light Blue,Sharuk Khan;Mahathma Gandhi;Jack Ma,un happy,proud image,6,0
2021/07/08 8:09:52 am GMT+5:30,31,1,Black,Kusal Mendis;Gotabaya Rajapaksha;Sakvithi Ranasinghe,mid happy,happy image,4,2
2021/07/08 8:10:07 am GMT+5:30,39,0,Black,Marilyn Monroe;Mark Zuckerberg;Sushant Singh Rajput,low sad,happy image,3,2
2021/07/08 8:10:17 am GMT+5:30,30,0,Grey,Sharuk Khan;Jack Ma;Osama-bin-Laden,un happy,happy image,5,2
2021/07/08 8:10:26 am GMT+5:30,38,1,Grey,Sharuk Khan;Idi Amin;Nelson Mandela,un happy,happy image,3,2
2021/07/08 8:10:36 am GMT+5:30,38,0,Green,Kusal Mendis;Osama-bin-Laden;Sushant Singh Rajput,mid happy,proud image,6,1
2021/07/08 8:10:44 am GMT+5:30,41,1,Yellow,Sakvithi Ranasinghe;Sharuk Khan;Nelson Mandela,happy,happy image,8,0
2021/07/08 8:10:53 am GMT+5:30,49,0,Light Blue,Adolf Hitler;Gotabaya Rajapaksha;Dasun Nishan,mid happy,happy image,4,2
2021/07/08 8:12:20 am GMT+5:30,49,1,Purple,Adolf Hitler;Dasun Nishan;Nelson Mandela,mid happy,proud image,6,1
2021/07/08 8:12:46 am GMT+5:30,50,1,Purple,Kusal Mendis;Nelson Mandela;Malala Yousafzai,happy,happy image,7,0
2021/07/08 8:12:54 am GMT+5:30,25,0,Yellow,Idi Amin;Jack Ma;Malala Yousafzai,low sad,happy image,6,0
2021/07/08 8:13:04 am GMT+5:30,49,0,Yellow,Nelson Mandela;Jack Ma;Sakvithi Ranasinghe,happy,happy image,7,0
2021/07/08 8:13:12 am GMT+5:30,39,1,Yellow,Sharuk Khan;Marilyn Monroe;Jack Ma,mid happy,happy image,8,0
2021/07/08 8:13:20 am GMT+5:30,44,1,Brown,Idi Amin;Nelson Mandela;Mark Zuckerberg,happy,proud image,7,0
2021/07/08 8:13:32 am GMT+5:30,19,1,Black,Marilyn Monroe;Adolf Hitler;Nelson Mandela,mid happy,proud image,9,1
2021/07/08 8:13:44 am GMT+5:30,25,1,Dark Blue,Sushant Singh Rajput;Nelson Mandela;Mark Zuckerberg,un happy,proud image,8,1
2021/07/08 8:13:52 am GMT+5:30,35,1,Dark Blue,Sushant Singh Rajput;Mahathma Gandhi;Jack Ma,happy,proud image,9,1
2021/07/08 8:14:00 am GMT+5:30,38,1,Brown,Jack Ma;Nelson Mandela;Malala Yousafzai,happy,happy image,9,0
2021/07/08 8:14:08 am GMT+5:30,43,0,Orange,Mahathma Gandhi;Marilyn Monroe;Sharuk Khan,mid happy,sad image,8,1
2021/07/08 8:14:19 am GMT+5:30,27,0,Brown,Jack Ma;Kusal Mendis;Malala Yousafzai,happy,proud image,6,1
2021/07/08 8:14:30 am GMT+5:30,25,0,Yellow,Jack Ma;Sushant Singh Rajput;Osama-bin-Laden,mid happy,sad image,8,1
2021/07/08 8:14:45 am GMT+5:30,41,0,Yellow,Adolf Hitler;Kusal Mendis;Malala Yousafzai,mid happy,proud image,6,1
2021/07/08 8:14:56 am GMT+5:30,25,0,Yellow,Osama-bin-Laden;Kusal Mendis;Sharuk Khan,mid happy,proud image,7,1
2021/07/08 8:15:06 am GMT+5:30,20,1,Grey,Osama-bin-Laden;Kusal Mendis;Gotabaya Rajapaksha,mid happy,suicide image,5,2
2021/07/08 8:15:18 am GMT+5:30,29,1,Green,Kusal Mendis;Sushant Singh Rajput;Sakvithi Ranasinghe,un happy,proud image,8,1
2021/07/08 8:15:26 am GMT+5:30,36,0,Dark Blue,Dasun Nishan;Mahathma Gandhi;Osama-bin-Laden,happy,proud image,7,1
2021/07/08 8:15:40 am GMT+5:30,33,1,Yellow,Sharuk Khan;Marilyn Monroe;Malala Yousafzai,happy,proud image,7,1
2021/07/08 8:15:49 am GMT+5:30,39,0,Purple,Sakvithi Ranasinghe;Sharuk Khan;Marilyn Monroe,happy,proud image,9,1
2021/07/08 8:15:58 am GMT+5:30,29,0,Purple,Nelson Mandela;Adolf Hitler;Sushant Singh Rajput,happy,proud image,8,1
2021/07/08 8:16:08 am GMT+5:30,28,0,Brown,Malala Yousafzai;Jack Ma;Sakvithi Ranasinghe,mid happy,happy image,6,0
2021/07/08 8:50:37 am GMT+5:30,42,0,Black,Sushant Singh Rajput;Mark Zuckerberg;Mahathma Gandhi,mid happy,happy image,5,2
2021/07/08 10:49:08 am GMT+5:30,20,0,Dark Blue,Sushant Singh Rajput,mid happy,proud image,7,1
2021/07/08 11:55:09 am GMT+5:30,22,1,Dark Blue,Sharuk Khan;Mahathma Gandhi;Mark Zuckerberg,happy,happy image,6,0
2021/07/08 6:19:14 pm GMT+5:30,40,0,Light Blue,Nelson Mandela;Kusal Mendis;Mahathma Gandhi,happy,sad image,9,1
sleeping hours,perfercol_Black,perfercol_Brown,perfercol_Dark Blue,perfercol_Green,perfercol_Grey,perfercol_Light Blue,perfercol_Orange,perfercol_Purple,perfercol_Yellow,react_angry,react_happy,react_low sad,react_mid happy,react_sad,react_un happy,sel_image_angry image,sel_image_happy image,sel_image_proud image,sel_image_sad image,sel_image_suicide image,person_category1,person_category2,person_category3,person_category4
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
color=['Purple'-0, 'Dark Blue'-1, 'Light Blue'-2, 'Brown'-3, 'Black'-4, 'Green'-5,'Yellow'-6, 'Orange'-7, 'Grey'-8]
person=[["Mark Zuckerberg","Jack Ma", "Sharuk Khan","Malala Yousafzai","Mahathma Gandhi", "Nelson Mandela"]-0
["Kusal Mendis", "Gotabaya Rajapaksha" , "Sakvithi Ranasinghe"]-1
["Osama-bin-Laden", "Idi Amin", "Adolf Hitler"]-2
["Sushant Singh Rajput", "Dasun Nishan", "Marilyn Monroe"]-3]
react=['happy'-0,'mid happy'-1,'un happy'-2,'low sad'-3,'angry'-4,'sad'-5]
select image=['angry image'-0,'happy image'-1,'proud image'-2,'sad image'-3,'suicide image'-4]
sleep hours=number between 1-12
\ No newline at end of file
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "b95bcb5e",
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"import pandas as pd\n",
"import numpy as np\n",
"def predict(colour,select_person,react,select_image,sleeping_hours): \n",
" load_model=pickle.load(open(\"best_model.sav\", 'rb'))\n",
" in_X=pd.read_csv('in_X.csv')\n",
" col_list=['Purple', 'Dark Blue', 'Light Blue', 'Brown', 'Black', 'Green','Yellow', 'Orange', 'Grey']\n",
" react_list=['happy','mid happy','un happy','low sad','angry','sad']\n",
" selimg_list=['angry image','happy image','proud image','sad image','suicide image']\n",
" in_X['perfercol_'+col_list[colour]]=1\n",
" in_X['react_'+react_list[react]]=1\n",
" in_X['sel_image_'+selimg_list[select_image]]=1\n",
" in_X['sleeping hours']=sleeping_hours/12\n",
" for i in range(3):\n",
" in_X['person_category'+str(select_person[i]+1)]=in_X['person_category'+str(select_person[i]+1)]+1\n",
" y_pred=load_model.predict(in_X)\n",
" return(y_pred[0])"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "9c468731",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(colour=4,select_person=(0,1,1),react=1,select_image=2,sleeping_hours=10)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "a6842280",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(colour=4,select_person=(3,3,3),react=0,select_image=1,sleeping_hours=10)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "4d5f185a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(colour=5,select_person=(0,0,0),react=0,select_image=2,sleeping_hours=6)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a6862609",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "b95bcb5e",
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"def predict(colour,select_person1,select_person2,select_person3,react,select_image,sleeping_hours): \n",
" load_model=pickle.load(open(\"best_model.sav\", 'rb'))\n",
" in_X=pd.read_csv('in_X.csv')\n",
" select_person=(select_person1,select_person2,select_person3)\n",
" col_list=['Purple', 'Dark Blue', 'Light Blue', 'Brown', 'Black', 'Green','Yellow', 'Orange', 'Grey']\n",
" react_list=['happy','mid happy','un happy','low sad','angry','sad']\n",
" selimg_list=['angry image','happy image','proud image','sad image','suicide image']\n",
" in_X['perfercol_'+col_list[colour]]=1\n",
" in_X['react_'+react_list[react]]=1\n",
" in_X['sel_image_'+selimg_list[select_image]]=1\n",
" in_X['sleeping hours']=sleeping_hours/12\n",
" for i in range(3):\n",
" in_X['person_category'+str(select_person[i]+1)]=in_X['person_category'+str(select_person[i]+1)]+1\n",
" y_pred=load_model.predict(in_X)\n",
" return(y_pred[0])"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "9c468731",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(4,0,1,1,1,2,10)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "a6842280",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(4,3,3,3,0,1,10)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "4d5f185a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(5,0,0,0,0,2,6)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "a6862609",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(7,0,0,0,0,2,6)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "1e3c521a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predict(5,3,3,3,5,4,6)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "42974f85",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: flask-ngrok in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (0.0.25)\n",
"Requirement already satisfied: Flask>=0.8 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from flask-ngrok) (2.0.2)\n",
"Requirement already satisfied: requests in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from flask-ngrok) (2.26.0)\n",
"Requirement already satisfied: click>=7.1.2 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Flask>=0.8->flask-ngrok) (8.0.3)\n",
"Requirement already satisfied: Jinja2>=3.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Flask>=0.8->flask-ngrok) (3.0.2)\n",
"Requirement already satisfied: Werkzeug>=2.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Flask>=0.8->flask-ngrok) (2.0.2)\n",
"Requirement already satisfied: itsdangerous>=2.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Flask>=0.8->flask-ngrok) (2.0.1)\n",
"Requirement already satisfied: charset-normalizer~=2.0.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->flask-ngrok) (2.0.7)\n",
"Requirement already satisfied: idna<4,>=2.5 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->flask-ngrok) (3.2)\n",
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->flask-ngrok) (2021.10.8)\n",
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->flask-ngrok) (1.26.7)\n",
"Requirement already satisfied: colorama in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from click>=7.1.2->Flask>=0.8->flask-ngrok) (0.4.4)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\pasindu\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from Jinja2>=3.0->Flask>=0.8->flask-ngrok) (2.0.1)\n"
]
}
],
"source": [
"!pip install flask-ngrok"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7c0caa04",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * Serving Flask app '__main__' (lazy loading)\n",
" * Environment: production\n",
"\u001b[31m WARNING: This is a development server. Do not use it in a production deployment.\u001b[0m\n",
"\u001b[2m Use a production WSGI server instead.\u001b[0m\n",
" * Debug mode: off\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n",
"Exception in thread Thread-13:\n",
"Traceback (most recent call last):\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\threading.py\", line 973, in _bootstrap_inner\n",
" self.run()\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\threading.py\", line 1286, in run\n",
" self.function(*self.args, **self.kwargs)\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\flask_ngrok.py\", line 70, in start_ngrok\n",
" ngrok_address = _run_ngrok()\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\flask_ngrok.py\", line 31, in _run_ngrok\n",
" ngrok = subprocess.Popen([executable, 'http', '5000'])\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\subprocess.py\", line 951, in __init__\n",
" self._execute_child(args, executable, preexec_fn, close_fds,\n",
" File \"C:\\Users\\Pasindu\\AppData\\Local\\Programs\\Python\\Python39\\lib\\subprocess.py\", line 1420, in _execute_child\n",
" hp, ht, pid, tid = _winapi.CreateProcess(executable, args,\n",
"OSError: [WinError 193] %1 is not a valid Win32 application\n"
]
}
],
"source": [
"\n",
"from flask_ngrok import run_with_ngrok\n",
"\n",
"from flask import Flask,jsonify\n",
"app=Flask(__name__)\n",
"run_with_ngrok(app) #starts ngrok when the app is running\n",
"@app.route(\"/<int:color>/<int:person1>/<int:person2>/<int:person3>/<int:react>/<int:image>/<int:sleepingH>\")\n",
"def home(color,person1,person2,person3,react,image,sleepingH):\n",
" p = []\n",
" p +=[color,person1,person2,person3,react,image,sleepingH]\n",
"\n",
" \n",
" \n",
" arr = p\n",
" predict =predict(arr)\n",
" if predict == [0]:\n",
" result = \"normal\"\n",
" elif predict == [1]:\n",
" result = \"mid mod\" \n",
" elif predict == [2]:\n",
" result = \"Severe\"\n",
" else:\n",
" result = \"extreame\"\n",
"\n",
" return jsonify(result)\n",
"app.run()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1d4524e2",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment