Commit 5b597f99 authored by W.D.R.P. Sandeepa's avatar W.D.R.P. Sandeepa

Merge branch 'master' into 'it18218640'

# Conflicts:
#   API/app.py
parents 8b02b03e 33fe1ad6
......@@ -9,4 +9,7 @@
<orderEntry type="jdk" jdkName="Python 3.9 (21_22j-38)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="renderExternalDocumentation" value="true" />
</component>
</module>
\ No newline at end of file
......@@ -9,5 +9,12 @@
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="tensorflow.keras" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PySciProjectComponent">
<option name="PY_SCI_VIEW" value="true" />
<option name="PY_SCI_VIEW_SUGGESTED" value="true" />
</component>
</project>
\ No newline at end of file
No preview for this file type
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="Flask">
<option name="enabled" value="true" />
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/templates" />
</list>
</option>
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/API.iml" filepath="$PROJECT_DIR$/.idea/API.iml" />
</modules>
</component>
</project>
\ No newline at end of file
from flask import Flask, redirect, url_for, render_template, request, jsonify, make_response
import random
import os
from API.keyword_spotting_service import Keyword_Spotting_service
from API.model.colorModel import get_color_activities1, get_color_activities2
from API.model.colorModel import get_color_activities1, get_color_activities2, get_color_activity_result
from API.model.readModel import get_reading_activities
from API.model.userModel import getStudentByName
from API.routers.router import funtion_one
# from backend.IT18218640.keyword_spotting_service import Keyword_Spotting_service
# from flask_mysqldb import MySQL
# import MySQLdb.cursors
# import re
app = Flask(__name__)
......@@ -13,6 +18,32 @@ app = Flask(__name__)
def home():
return render_template('home.html')
# @app.route('/register', methods =['POST'])
# def register():
# msg = ''
# if request.method == 'POST' and 'username' in request.form and 'password' in request.form and 'email' in request.form:
# username = request.form['username']
# password = request.form['password']
# email = request.form['email']
# cursor = mysql.connection.cursor(MySQLdb.cursors.DictCursor)
# cursor.execute('SELECT * FROM user WHERE name = % s', (username,))
# account = cursor.fetchone()
# if account:
# msg = 'Account already exists !'
# elif not re.match(r'[^@]+@[^@]+\.[^@]+', email):
# msg = 'Invalid email address !'
# elif not re.match(r'[A-Za-z0-9]+', username):
# msg = 'Username must contain only characters and numbers !'
# elif not username or not password or not email:
# msg = 'Please fill out the form !'
# else:
# cursor.execute('INSERT INTO accounts VALUES (NULL, % s, % s, % s)', (username, password, email,))
# mysql.connection.commit()
# msg = 'You have successfully registered !'
# elif request.method == 'POST':
# msg = 'Please fill out the form !'
# return msg
# Color Function Route (IT18218640)
# Get Color activities route
......@@ -24,62 +55,48 @@ def getColorActivities1():
def getColorActivities2():
return get_color_activities2()
@app.route("/predict", methods=["POST"])
def predict():
data = request.get_json()
print((f"{data}"))
fileitem = data['uri']
# if fileitem.filename:
# # strip the leading path from the file name
fn = os.path.basename(fileitem)
#
# # open read and write the file into the server
open(fn, 'wb').write(fileitem.file.read())
resp = make_response(request.get_json())
resp.headers['Access-Control-Allow-Origin'] = '*'
resp.headers['Content-Type'] = 'application/json'
return resp
# get audio file and save it
# audio_file = request.files["file"]
# audio_file = request.files["name"]
# print((f"{request.data}"))
# print((f"{request.form}"))
# print((f"{request.values}"))
# print((f"{request.json}"))
# print(f"{request.form['name']}")
# file_name = str(random.randint(0, 100000))
# audio_file.save((file_name))
#
# # get file name
# predict_file_name = audio_file.filename
# predict_file_name = predict_file_name.split("/")
# new_predict_file_name = predict_file_name[1]
# new_predict_file_name = new_predict_file_name.split(".")
# FPFN = new_predict_file_name[0]
# # print(f"{FPFN}")
#
# # invoke keyword spotting service
# kss = Keyword_Spotting_service()
#
#
# # make a prediction
# predicted_keyword = kss.predict(file_name, FPFN)
#
# # remove the audio file
# os.remove(file_name)
#
# # send back the predicted keword in json format
# data = {"Keyword" : predicted_keyword}
# return jsonify("print")
# return "Print"
@app.route("/getColorActivitiesResult")
def getColorActivitiesResult():
# print("data_dic")
return get_color_activity_result()
# @app.route("/predict", methods=["POST"])
# def predict():
# # get audio file and save it
# audio_file = request.files["file"]
#
# print(f"{request.files['file']}")
# # print(f"{request.files['name']}")
#
# ######################################
# print(f"{request.form['name']}")
# #####################################
# # print(f"{request.json}")
#
# file_name = str(random.randint(0, 100000))
# # audio_file.save((file_name))
#
# # get file name
# # predict_file_name = audio_file.filename
# # predict_file_name = predict_file_name.split("/")
# # new_predict_file_name = predict_file_name[1]
# # new_predict_file_name = new_predict_file_name.split(".")
# # FPFN = new_predict_file_name[0]
# # print(f"{FPFN}")
#
# # invoke keyword spotting service
# kss = Keyword_Spotting_service()
#
# # make a prediction
# predicted_keyword = kss.predict(file_name, request.form['name'])
#
# # remove the audio file
# os.remove(file_name)
#
# # send back the predicted keword in json format
# data = {"Keyword": predicted_keyword}
# return jsonify(data)
# # return "audio_file"
# Read Function Route (IT)
......@@ -99,7 +116,29 @@ def abc():
# return make_response(d, 200)
return response_val
# Loging
@app.route("/login", methods=['POST'])
def login():
req = request.get_json()
username = req['username']
password = req['password']
user = getStudentByName(username, password)
if len(user) == 0:
data = {
"body": [],
"message": "Failed"
}
else:
data = {
"body": user,
"message": "Success"
}
body = jsonify(data)
return make_response(body)
if __name__ == "__main__":
app.run(host='192.168.8.102')
#app.run(host='192.168.8.100,port='5000', debug=True)
# app.run(debug=True)
\ No newline at end of file
# app.run(host='192.168.8.101')
# app.run(host='192.168.8.100,port='5000', debug=True)
app.run(debug=True)
\ No newline at end of file
......@@ -12,13 +12,13 @@ def create_con():
database="helply",
host="127.0.0.1",
user="root",
password="rp19970520"
password="12345678"
)
return db
def create_con_pandas():
db_connection_str = 'mysql+mysqlconnector://root:rp19970520@127.0.0.1/helply'
db_connection_str = 'mysql+mysqlconnector://root:12345678@127.0.0.1/helply'
db = create_engine(db_connection_str)
return db
......
from API.db.dbConnection import get_data
def getStudentByName(username, password):
qry = 'SELECT * FROM `user` WHERE name = "{}" AND password = "{}"'.format(username, password)
user = get_data(qry)
return user
,teran,teran-HP-Notebook,06.02.2022 16:36,file:///home/teran/.config/libreoffice/4;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -46,6 +46,11 @@ def get_level():
test_data=[Q1,Q2,Q3,Q4,Q5,Q6,TD]
print(test_data)
return "terra"
model = load_dyslexia_model()
result=model.predict([test_data])
result=scaler_y.inverse_transform(result)[0][0]
results=[{"level":float(result)}]
return (jsonify(results=results))
app.run(host='0.0.0.0',port=5000)
This diff is collapsed.
{
"mappings": [],
"labels": [],
"MFCCs": [],
"files": []
}
\ No newline at end of file
......@@ -16,13 +16,26 @@ LogBox.ignoreAllLogs(); //Ignore all log notifications
// import Home from "./src/screen/Home";
// import Login from "./src/screen/auth/Login"
// import Register from "./src/screen/auth/Register"
import {createStore, combineReducers} from 'redux';
import {Provider} from 'react-redux';
import memoryReducer from './src/store/reducers/memory';
import timeReducer from './src/store/reducers/memory'
import AppRouter from "./src/router/router"
const rootReducer = combineReducers({
memory: memoryReducer,
time: timeReducer
});
const store = createStore(rootReducer);
function App() {
return (
<AppRouter/>
<Provider store={store}>
<AppRouter/>
</Provider>
);
}
......
This diff is collapsed.
......@@ -10,6 +10,7 @@
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/netinfo": "^7.1.7",
"@react-navigation/drawer": "^6.1.8",
"@react-navigation/native": "^6.0.6",
"@react-navigation/native-stack": "^6.2.5",
......@@ -18,6 +19,7 @@
"react": "17.0.2",
"react-native": "0.66.2",
"react-native-audio-record": "^0.2.2",
"react-native-countdown-component": "^2.7.1",
"react-native-elements": "^3.4.2",
"react-native-fontawesome": "^7.0.0",
"react-native-gesture-handler": "^1.10.3",
......@@ -26,8 +28,10 @@
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.9.0",
"react-native-table-component": "^1.2.2",
"react-native-vector-icons": "^9.0.0"
"react-native-table-component": "^1.2.1",
"react-native-vector-icons": "^9.0.0",
"react-redux": "^7.2.6",
"redux": "^4.1.2"
},
"devDependencies": {
"@babel/core": "^7.12.9",
......
import React from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
ImageBackground,
TouchableNativeFeedback,
Platform
} from 'react-native';
const CategoryItem = (props) => {
return(
<View style={styles.gameItem}>
<TouchableOpacity onPress={props.onSelectGame}>
<View>
<View style={{ ...styles.gameItemRow, ...styles.gameItemHeader }}>
<ImageBackground
style={styles.bgImage}
source={{ uri: props.image }}
>
<View style={styles.titleContainer}>
<Text style={styles.title} numberOfLines={1}>{props.title}</Text>
</View>
</ImageBackground>
</View>
</View>
<View style={{ ...styles.gameItemRow, ...styles.gameItemDetails }}>
<Text>Game {props.id}</Text>
<Text>Click here to play the Game</Text>
</View>
</TouchableOpacity>
</View>
);
}
const styles = StyleSheet.create({
gameItem : {
height: 200,
width: '100%',
backgroundColor: '#ccc',
marginVertical: 10,
borderRadius: 10,
overflow: 'hidden'
},
gameItemRow: {
flexDirection: 'row'
},
gameItemHeader: {
height: '90%'
},
gameItemDetails: {
height: '10%',
paddingHorizontal: 10,
justifyContent: 'space-between',
alignItems: 'center'
},
bgImage: {
height: '100%',
width: '100%',
justifyContent: 'flex-end'
},
title: {
color: 'white',
fontFamily: 'open-sans-bold',
fontSize: 18,
textAlign: 'center',
},
titleContainer: {
padding: 10,
backgroundColor: 'rgba(0,0,0,0.5)'
}
});
export default CategoryItem;
\ No newline at end of file
import React from 'react';
import {View, Text, StyleSheet, StatusBar, SafeAreaView} from 'react-native';
import Colors from '../../constants/Colors';
const Header = (props) => {
return (
<View style={StyleSheet.header}>
<Text style={styles.headerTitle}>Show Time</Text>
</View>
);
}
const styles = StyleSheet.create({
header: {
width: '100%',
height: 90,
paddingTop: 36,
backgroundColor: Colors.primary,
justifyContent: 'center',
alignItems: 'center'
},
headerTitle: {
color: 'white',
fontSize: 18
}
});
export default Header;
import React from 'react';
import {Text, View} from 'react-native';
const TimeTracker = () => {
const [time, setTime] = useState(0);
const [timerOn, setTimeOn] = useState(true);
useEffect(()=>{
let interval = null;
if(timerOn){
interval = setInterval(()=>{
setTime(prevTime=> prevTime + 20)
},10)
}else{
clearInterval(interval);
}
return () => clearInterval(interval);
},[timerOn]);
}
export default TimeTracker;
\ No newline at end of file
export default {
primary: '#f7287b',
secondary: '#c717fc'
}
\ No newline at end of file
import Category from "../models/category";
export const CATEGORIES = [
new Category('1', 'Memo', 'https://cdn.pixabay.com/photo/2014/09/21/21/31/flowers-455591_960_720.jpg'),
new Category('2', 'Inorder', 'https://cdn.pixabay.com/photo/2019/02/22/19/03/numbers-4014181_960_720.jpg'),
new Category('3', 'Shapes', 'https://cdn.pixabay.com/photo/2018/08/22/12/38/color-3623523_960_720.jpg'),
new Category('4', 'Memo', 'https://cdn.pixabay.com/photo/2014/09/21/21/31/flowers-455591_960_720.jpg'),
]
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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