Commit 32e5fcca authored by W.D.R.P. Sandeepa's avatar W.D.R.P. Sandeepa

changes

parents f2198443 6ba28c5f
# import MySQLdb
<<<<<<< HEAD
from flask import Flask, render_template, request, jsonify, make_response
from API.model.color.colorModel import save_color_session_details, sendPredictData
from API.model.readModel import save_activity_details, save_session_details
from API.model.userModel import getUser, saveUserSession, logoutUser
from API.model.color.colorModel import get_color_activities1, get_color_activities2, get_color_activity_result, storeResult
=======
from flask import Flask, redirect, url_for, render_template, request, jsonify, make_response
import random
import os
from API.model.colorModel import get_color_activities1, get_color_activities2, get_color_activity_result, \
save_color_session_details
from API.model.readModel import *
from API.model.userModel import *
from API.model.colorModel import get_color_activities1, get_color_activities2, get_color_activity_result, storeResult
from API.model.readModel import get_reading_activities
from API.routers.router import funtion_one
>>>>>>> 6ba28c5f30fd429a3ed34216b55a685d5b3615f0
# from backend.IT18218640.keyword_spotting_service import Keyword_Spotting_service
......@@ -66,6 +79,7 @@ def predict():
@app.route("/colorSession", methods=['POST'])
def color_session():
req = request.get_json()
......@@ -159,6 +173,19 @@ def reading_session():
return make_response(body)
@app.route("/readingSession/<readingToken>", methods=['PUT'])
def reading_session_status_update(readingToken):
assert readingToken == request.view_args['readingToken']
token = readingToken
token = update_session_status(token)
response = {
"message": "Success",
"status": 200
}
body = jsonify(response)
return make_response(body)
@app.route("/reading/<readingToken>", methods=['POST'])
def reading(readingToken):
assert readingToken == request.view_args['readingToken']
......@@ -178,4 +205,4 @@ def reading(readingToken):
if __name__ == "__main__":
app.run(host='192.168.8.100')
app.run(host='192.168.1.100')
......@@ -12,7 +12,7 @@ def create_con():
database="helply",
host="127.0.0.1",
user="root",
password="rp19970520"
password="12345678"
)
return db
......
from API.db.dbConnection import get_all_data, insert
from API.db.dbConnection import *
from flask import jsonify
from API.util.util import getUUID
def get_reading_activities():
data_dic = []
qry = 'SELECT * FROM reading'
......@@ -32,3 +33,8 @@ def save_session_details(userId, status):
args = (userId, token, status)
insert(qry, args)
return token
def update_session_status(token):
qry = 'UPDATE readingSession SET status = 0 WHERE token = "{}"'.format(token)
return update_data(qry)
from API.db.dbConnection import insert, update_data, get_data
from API.db.dbConnection import *
from API.util.util import getUUID
from datetime import datetime
......
......@@ -4,6 +4,13 @@ export const ImagePaths = {
summery: require('../image/ReadHeaderImg4.webp'),
robot1: require('../image/robot1.png'),
robot2: require('../image/activity-2-rob.png'),
backgroundBasic: require('../image/activity-2-backg.jpeg'),
no: require('../image/no.png'),
go: require('../image/go.png'),
he: require('../image/he.png'),
bird: require('../image/bird.png'),
dog: require('../image/dog.png'),
fish: require('../image/fish.png'),
};
export const DummyReadResult = {
......
......@@ -19,6 +19,9 @@ import White from '../screen/activity/White';
import Read from '../screen/Read';
import ReadActivity from '../screen/reading/ReadActivity';
import ReadActivityBird from '../screen/reading/advanced/ReadActivityBird';
import ReadActivityNo from '../screen/reading/basic/ReadActivityNo';
import ReadActivityGo from '../screen/reading/basic/ReadActivityGo';
import ReadActivityHe from '../screen/reading/basic/ReadActivityHe';
import ColorResult from '../screen/result/ColorResult';
import PrimaryType from '../screen/activity/PrimaryType';
import SecondaryType from '../screen/activity/SecondaryType';
......@@ -129,6 +132,21 @@ const AppRouter = () => {
name="ReadActivity"
component={ReadActivity}
/>
<Stack.Screen
options={{headerShown: false}}
name="ReadActivityNo"
component={ReadActivityNo}
/>
<Stack.Screen
options={{headerShown: false}}
name="ReadActivityGo"
component={ReadActivityGo}
/>
<Stack.Screen
options={{headerShown: false}}
name="ReadActivityHe"
component={ReadActivityHe}
/>
<Stack.Screen
options={{headerShown: false}}
name="ReadActivityBird"
......
import { useNavigation } from '@react-navigation/native';
import {useNavigation} from '@react-navigation/native';
import axios from 'axios';
import Orientation from 'react-native-orientation-locker';
import React, { useState, useEffect } from 'react';
import React, {useState, useEffect} from 'react';
import {
StyleSheet,
View,
......@@ -20,7 +20,7 @@ import {
import ImageButton from '../component/ImageButton';
import ButtonView from '../component/buttonView';
import ReadCategory from '../component/reading/ReadCategory';
import { ImagePaths } from '../assets/read/data/ReadData';
import {ImagePaths} from '../assets/read/data/ReadData';
export default function Read() {
const [activity, setActivity] = useState([]);
......@@ -53,7 +53,7 @@ export default function Read() {
<ReadCategory
title={'Basic'}
image={ImagePaths.roundOne}
path={'ReadActivity'}
path={'ReadActivityNo'}
/>
<ReadCategory
title={'Advanced'}
......
......@@ -2,6 +2,6 @@ import axios from 'axios';
// export default axios.create({ baseURL: 'http://192.168.8.102:5000/', timeout: 15000, });
export default axios.create({
baseURL: 'http://192.168.8.100:5000/',
baseURL: 'http://192.168.1.100:5000/',
timeout: 15000,
});
......@@ -106,14 +106,6 @@ export default function ReadActivity() {
<Text style={styles.text}>Pronounce this Word!</Text>
</View>
</View>
{/* <View style={styles.textBody}>
<Text style={styles.text}>Pronounce this Word!</Text>
</View>
<View style={styles.robo}>
<Image
source={require('../../assets/read/activity-2-rob.png')}></Image>
</View> */}
<View>
<Image
style={styles.blackboard}
......@@ -158,7 +150,6 @@ const styles = StyleSheet.create({
box: {
width: 180,
height: 180,
// borderColor: "#000000",
backgroundColor: 'blue',
marginTop: -370,
marginLeft: 455,
......@@ -177,8 +168,8 @@ const styles = StyleSheet.create({
height: 200,
},
textBody: {
marginTop: 150,
marginLeft: -30,
marginTop: 130,
marginLeft: -50,
// backgroundColor: '#00008B',
width: 150,
borderRadius: 50,
......@@ -190,7 +181,7 @@ const styles = StyleSheet.create({
alignItems: 'center',
color: '#00008B',
borderRadius: 10,
backgroundColor: 'rgba(0,0,0,0.2)',
backgroundColor: 'rgba(2, 202, 106, 0.17)',
textAlign: 'center',
fontWeight: 'bold',
},
......@@ -205,7 +196,7 @@ const styles = StyleSheet.create({
height: 50,
},
horizontalView: {
backgroundColor: 'rgba(0,0,0,0.2)',
backgroundColor: 'rgba(23, 0, 245, 0.17)',
borderRadius: 50,
flexDirection: 'row',
position: 'absolute',
......
......@@ -14,9 +14,11 @@ import {
TouchableHighlight,
} from 'react-native';
import Voice from '@react-native-voice/voice';
import {DummyReadResult} from '../../assets/read/data/ReadData';
import {DummyReadResult, ImagePaths} from '../../../assets/read/data/ReadData';
export default function ReadActivityGo() {
const navigation = useNavigation();
const [pitch, setPitch] = useState('');
const [error, setError] = useState('');
const [end, setEnd] = useState('');
......@@ -60,6 +62,7 @@ export default function ReadActivityGo() {
if (result.includes('hello')) {
console.log('correct');
navigation.navigate('ReadActivityHe');
}
};
......@@ -94,12 +97,11 @@ export default function ReadActivityGo() {
<View style={{flexDirection: 'column'}}>
<ImageBackground
style={styles.image}
source={require('../../assets/read/image/activity-2-backg.jpeg')}>
source={ImagePaths.backgroundBasic}>
<View style={styles.imageContainer}>
<View style={styles.imageView}>
<View style={styles.robo}>
<Image
source={require('../../assets/read/image/activity-2-rob.png')}></Image>
<Image source={ImagePaths.robot2}></Image>
</View>
</View>
<View style={styles.textBody}>
......@@ -115,9 +117,7 @@ export default function ReadActivityGo() {
</View> */}
<View>
<Image
style={styles.blackboard}
source={require('../../assets/read/image/backboard3.png')}></Image>
<Image style={styles.blackboard} source={ImagePaths.go}></Image>
</View>
<View style={styles.horizontalView}>
<TouchableHighlight onPress={startRecording}>
......@@ -158,7 +158,6 @@ const styles = StyleSheet.create({
box: {
width: 180,
height: 180,
// borderColor: "#000000",
backgroundColor: 'blue',
marginTop: -370,
marginLeft: 455,
......@@ -177,8 +176,8 @@ const styles = StyleSheet.create({
height: 200,
},
textBody: {
marginTop: 150,
marginLeft: -30,
marginTop: 130,
marginLeft: -50,
// backgroundColor: '#00008B',
width: 150,
borderRadius: 50,
......@@ -190,7 +189,7 @@ const styles = StyleSheet.create({
alignItems: 'center',
color: '#00008B',
borderRadius: 10,
backgroundColor: 'rgba(0,0,0,0.2)',
backgroundColor: 'rgba(2, 202, 106, 0.17)',
textAlign: 'center',
fontWeight: 'bold',
},
......@@ -205,7 +204,7 @@ const styles = StyleSheet.create({
height: 50,
},
horizontalView: {
backgroundColor: 'rgba(0,0,0,0.2)',
backgroundColor: 'rgba(23, 0, 245, 0.17)',
borderRadius: 50,
flexDirection: 'row',
position: 'absolute',
......
......@@ -14,9 +14,11 @@ import {
TouchableHighlight,
} from 'react-native';
import Voice from '@react-native-voice/voice';
import {DummyReadResult} from '../../assets/read/data/ReadData';
import {DummyReadResult, ImagePaths} from '../../../assets/read/data/ReadData';
export default function ReadActivityHe() {
const navigation = useNavigation();
const [pitch, setPitch] = useState('');
const [error, setError] = useState('');
const [end, setEnd] = useState('');
......@@ -60,6 +62,7 @@ export default function ReadActivityHe() {
if (result.includes('hello')) {
console.log('correct');
navigation.navigate('ReadActivityHe');
}
};
......@@ -94,30 +97,20 @@ export default function ReadActivityHe() {
<View style={{flexDirection: 'column'}}>
<ImageBackground
style={styles.image}
source={require('../../assets/read/image/activity-2-backg.jpeg')}>
source={ImagePaths.backgroundBasic}>
<View style={styles.imageContainer}>
<View style={styles.imageView}>
<View style={styles.robo}>
<Image
source={require('../../assets/read/image/activity-2-rob.png')}></Image>
<Image source={ImagePaths.robot2}></Image>
</View>
</View>
<View style={styles.textBody}>
<Text style={styles.text}>Pronounce this Word!</Text>
</View>
</View>
{/* <View style={styles.textBody}>
<Text style={styles.text}>Pronounce this Word!</Text>
</View>
<View style={styles.robo}>
<Image
source={require('../../assets/read/activity-2-rob.png')}></Image>
</View> */}
<View>
<Image
style={styles.blackboard}
source={require('../../assets/read/image/backboard3.png')}></Image>
<Image style={styles.blackboard} source={ImagePaths.he}></Image>
</View>
<View style={styles.horizontalView}>
<TouchableHighlight onPress={startRecording}>
......@@ -158,7 +151,6 @@ const styles = StyleSheet.create({
box: {
width: 180,
height: 180,
// borderColor: "#000000",
backgroundColor: 'blue',
marginTop: -370,
marginLeft: 455,
......@@ -177,8 +169,8 @@ const styles = StyleSheet.create({
height: 200,
},
textBody: {
marginTop: 150,
marginLeft: -30,
marginTop: 130,
marginLeft: -50,
// backgroundColor: '#00008B',
width: 150,
borderRadius: 50,
......@@ -190,7 +182,7 @@ const styles = StyleSheet.create({
alignItems: 'center',
color: '#00008B',
borderRadius: 10,
backgroundColor: 'rgba(0,0,0,0.2)',
backgroundColor: 'rgba(2, 202, 106, 0.17)',
textAlign: 'center',
fontWeight: 'bold',
},
......@@ -205,7 +197,7 @@ const styles = StyleSheet.create({
height: 50,
},
horizontalView: {
backgroundColor: 'rgba(0,0,0,0.2)',
backgroundColor: 'rgba(23, 0, 245, 0.17)',
borderRadius: 50,
flexDirection: 'row',
position: 'absolute',
......
......@@ -14,9 +14,11 @@ import {
TouchableHighlight,
} from 'react-native';
import Voice from '@react-native-voice/voice';
import {DummyReadResult} from '../../assets/read/data/ReadData';
import {DummyReadResult, ImagePaths} from '../../../assets/read/data/ReadData';
export default function ReadActivityNo() {
const navigation = useNavigation();
const [pitch, setPitch] = useState('');
const [error, setError] = useState('');
const [end, setEnd] = useState('');
......@@ -60,6 +62,7 @@ export default function ReadActivityNo() {
if (result.includes('hello')) {
console.log('correct');
navigation.navigate('ReadActivityGo');
}
};
......@@ -94,30 +97,20 @@ export default function ReadActivityNo() {
<View style={{flexDirection: 'column'}}>
<ImageBackground
style={styles.image}
source={require('../../assets/read/image/activity-2-backg.jpeg')}>
source={ImagePaths.backgroundBasic}>
<View style={styles.imageContainer}>
<View style={styles.imageView}>
<View style={styles.robo}>
<Image
source={require('../../assets/read/image/activity-2-rob.png')}></Image>
<Image source={ImagePaths.robot2}></Image>
</View>
</View>
<View style={styles.textBody}>
<Text style={styles.text}>Pronounce this Word!</Text>
</View>
</View>
{/* <View style={styles.textBody}>
<Text style={styles.text}>Pronounce this Word!</Text>
</View>
<View style={styles.robo}>
<Image
source={require('../../assets/read/activity-2-rob.png')}></Image>
</View> */}
<View>
<Image
style={styles.blackboard}
source={require('../../assets/read/image/backboard3.png')}></Image>
<Image style={styles.blackboard} source={ImagePaths.no}></Image>
</View>
<View style={styles.horizontalView}>
<TouchableHighlight onPress={startRecording}>
......@@ -158,7 +151,6 @@ const styles = StyleSheet.create({
box: {
width: 180,
height: 180,
// borderColor: "#000000",
backgroundColor: 'blue',
marginTop: -370,
marginLeft: 455,
......@@ -177,8 +169,8 @@ const styles = StyleSheet.create({
height: 200,
},
textBody: {
marginTop: 150,
marginLeft: -30,
marginTop: 130,
marginLeft: -50,
// backgroundColor: '#00008B',
width: 150,
borderRadius: 50,
......@@ -190,7 +182,7 @@ const styles = StyleSheet.create({
alignItems: 'center',
color: '#00008B',
borderRadius: 10,
backgroundColor: 'rgba(0,0,0,0.2)',
backgroundColor: 'rgba(2, 202, 106, 0.17)',
textAlign: 'center',
fontWeight: 'bold',
},
......@@ -205,7 +197,7 @@ const styles = StyleSheet.create({
height: 50,
},
horizontalView: {
backgroundColor: 'rgba(0,0,0,0.2)',
backgroundColor: 'rgba(23, 0, 245, 0.17)',
borderRadius: 50,
flexDirection: 'row',
position: 'absolute',
......
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