Commit ad5b090a authored by Lihinikaduwa D.N.R.  's avatar Lihinikaduwa D.N.R.

some changes

parents f1803cbb 214242e2
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<excludeFolder url="file://$MODULE_DIR$/API/venv" /> <excludeFolder url="file://$MODULE_DIR$/API/venv" />
<excludeFolder url="file://$MODULE_DIR$/backend/IT18257632/venv" /> <excludeFolder url="file://$MODULE_DIR$/backend/IT18257632/venv" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project> </project>
\ No newline at end of file
...@@ -45,6 +45,10 @@ def abc(): ...@@ -45,6 +45,10 @@ def abc():
if __name__ == "__main__": if __name__ == "__main__":
<<<<<<< HEAD
# app.run(host='192.168.1.101') # app.run(host='192.168.1.101')
=======
app.run(host='192.168.8.102')
>>>>>>> 214242e2720ae6c4a2b68a5dcc181a9640a724ab
# app.run(host='192.168.8.100,port='5000', debug=True) # app.run(host='192.168.8.100,port='5000', debug=True)
app.run(debug=True) # app.run(debug=True)
...@@ -12,13 +12,13 @@ def create_con(): ...@@ -12,13 +12,13 @@ def create_con():
database="helply", database="helply",
host="127.0.0.1", host="127.0.0.1",
user="root", user="root",
password="12345678" password="rp19970520"
) )
return db return db
def create_con_pandas(): def create_con_pandas():
db_connection_str = 'mysql+mysqlconnector://root:12345678@127.0.0.1/helply' db_connection_str = 'mysql+mysqlconnector://root:rp19970520@127.0.0.1/helply'
db = create_engine(db_connection_str) db = create_engine(db_connection_str)
return db return db
......
...@@ -6,4 +6,5 @@ def get_color_activities(): ...@@ -6,4 +6,5 @@ def get_color_activities():
response = get_all_data(qry) response = get_all_data(qry)
return response return response
\ No newline at end of file
from pydub import AudioSegment
from os import path
import subprocess
def main():
src = input("src/Blue1643090283.mp3")
dst = input("src/test.wav")
sound = AudioSegment.from_mp3(src)
sound.export(dst, format="wav")
print(f"{'sound'}")
# # files
# src = "src/Blue1643090283.mp3"
# dst = "dst/test.wav"
#
# # subprocess.call(['ffmpeg', '-i', 'src/Blue1643090283.mp3', 'dst/test.wav'])
#
# # convert wav to mp3
# audSeg = AudioSegment.from_mp3(src).export(dst, format="wav")
#
# # print(f"{audSeg}")
if __name__ == "__main__":
main()
\ No newline at end of file
...@@ -18,7 +18,7 @@ def predict(): ...@@ -18,7 +18,7 @@ def predict():
new_predict_file_name = predict_file_name[1] new_predict_file_name = predict_file_name[1]
new_predict_file_name = new_predict_file_name.split(".") new_predict_file_name = new_predict_file_name.split(".")
FPFN = new_predict_file_name[0] FPFN = new_predict_file_name[0]
print(f"{FPFN}") # print(f"{FPFN}")
# invoke keyword spotting service # invoke keyword spotting service
kss = Keyword_Spotting_service() kss = Keyword_Spotting_service()
...@@ -34,6 +34,6 @@ def predict(): ...@@ -34,6 +34,6 @@ def predict():
return jsonify(data) return jsonify(data)
if __name__ == "__main__": if __name__ == "__main__":
# app.run(host='192.168.8.102') # app.run(host='192.168.8.100')
#app.run(host='192.168.8.100,port='5000', debug=True) #app.run(host='192.168.8.100,port='5000', debug=True)
app.run(debug=False) app.run(debug=False)
\ No newline at end of file
...@@ -3,6 +3,7 @@ import numpy as np ...@@ -3,6 +3,7 @@ import numpy as np
import tensorflow.keras as keras import tensorflow.keras as keras
from sklearn.model_selection import train_test_split from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from keras.callbacks import ModelCheckpoint
DATA_PATH = "data.json" DATA_PATH = "data.json"
SAVE_MODEL_PATH = "model.h5" SAVE_MODEL_PATH = "model.h5"
...@@ -11,7 +12,7 @@ LEARNING_RATE = 0.0001 ...@@ -11,7 +12,7 @@ LEARNING_RATE = 0.0001
EPOCHS = 60 EPOCHS = 60
BATCH_SIZE = 32 BATCH_SIZE = 32
NUM_KEYWORDS = 10 NUM_KEYWORDS = 6
def load_dataset(data_path): def load_dataset(data_path):
...@@ -66,6 +67,12 @@ def build_model(input_shape, learning_rate, error="sparse_categorical_crossentro ...@@ -66,6 +67,12 @@ def build_model(input_shape, learning_rate, error="sparse_categorical_crossentro
model.add(keras.layers.Dense(64, activation="relu")) model.add(keras.layers.Dense(64, activation="relu"))
model.add(keras.layers.Dropout(0.3)) model.add(keras.layers.Dropout(0.3))
# model.add(keras.layers.Flatten())
# model.add(keras.layers.Dense(128, activation="relu"))
# model.add(keras.layers.Dense(64, activation="relu"))
# model.add(keras.layers.Dropout(0.3))
# model.add(keras.layers.Dense(16, activation="relu"))
# softmax classifier # softmax classifier
model.add(keras.layers.Dense(NUM_KEYWORDS, activation="softmax")) model.add(keras.layers.Dense(NUM_KEYWORDS, activation="softmax"))
...@@ -104,12 +111,15 @@ def main(): ...@@ -104,12 +111,15 @@ def main():
input_shape = (X_train.shape[1], X_train.shape[2], X_train.shape[3],) input_shape = (X_train.shape[1], X_train.shape[2], X_train.shape[3],)
model = build_model(input_shape, LEARNING_RATE) model = build_model(input_shape, LEARNING_RATE)
# check Point
checkpoint = ModelCheckpoint('models/model-{epoch:03d}.h5', monitor='val_loss', save_best_only=True, mode='auto')
# train the model # train the model
history = model.fit(X_train, y_train, epochs=EPOCHS, batch_size=BATCH_SIZE, validation_data=(X_validation, y_validation)) history = model.fit(X_train, y_train, epochs=EPOCHS, batch_size=BATCH_SIZE, validation_data=(X_validation, y_validation), callbacks=[checkpoint])
# evaluate the model # evaluate the model
test_error, test_accuracy = model.evaluate(X_test, y_test) # test_error, test_accuracy = model.evaluate(X_test, y_test)
print(f"Test error: {test_error}, test accuracy: {test_accuracy}") # print(f"Test error: {test_error}, test accuracy: {test_accuracy}")
# save the model # save the model
model.save(SAVE_MODEL_PATH) model.save(SAVE_MODEL_PATH)
......
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import React from "react"; import React, {useEffect} from "react";
import {Text, TouchableOpacity, StyleSheet, View, Image} from 'react-native' import {Text, TouchableOpacity, StyleSheet, View, Image} from 'react-native'
...@@ -10,7 +10,7 @@ export default function ColorActivity(props){ ...@@ -10,7 +10,7 @@ export default function ColorActivity(props){
const navigation = useNavigation(); const navigation = useNavigation();
return( return(
<TouchableOpacity onPress={()=> {navigation.navigate("Blue")}} <TouchableOpacity onPress={()=> {navigation.navigate("Blue", {color})}}
style={{ style={{
borderWidth: 5, borderWidth: 5,
borderColor: color, borderColor: color,
......
...@@ -8,7 +8,7 @@ import Register from '../screen/auth/Register'; ...@@ -8,7 +8,7 @@ import Register from '../screen/auth/Register';
import Login from '../screen/auth/Login'; import Login from '../screen/auth/Login';
import Splash from '../screen/splash/Splash'; import Splash from '../screen/splash/Splash';
import Color from '../screen/Color'; import Color from '../screen/Color';
import Blue from '../screen/Blue'; import Blue from '../screen/activity/Blue';
import Read from '../screen/Read'; import Read from '../screen/Read';
import ReadActivity from '../screen/activity/readActivity'; import ReadActivity from '../screen/activity/readActivity';
const Stack = createNativeStackNavigator(); const Stack = createNativeStackNavigator();
......
...@@ -6,7 +6,7 @@ import { StyleSheet, View, Text, Pressable, SafeAreaView, ScrollView, Image, Ima ...@@ -6,7 +6,7 @@ import { StyleSheet, View, Text, Pressable, SafeAreaView, ScrollView, Image, Ima
import ImageButton from "../component/ImageButton"; import ImageButton from "../component/ImageButton";
import ColorActivity from "../component/colorActivity"; import ColorActivity from "../component/colorActivity";
const webUrel = "http://192.168.8.101:5000/getColorActivities"; const webUrel = "http://192.168.8.102:5000/getColorActivities";
export default function Color(){ export default function Color(){
......
...@@ -18,9 +18,10 @@ import { ...@@ -18,9 +18,10 @@ import {
Image Image
} from 'react-native' } from 'react-native'
export default function Blue() { export default function Blue(color) {
const navigation = useNavigation(); const navigation = useNavigation();
const backColor = color.route.params.color;
React.useEffect(() => { React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => { const unsubscribe = navigation.addListener("focus", () => {
...@@ -36,7 +37,7 @@ export default function Blue() { ...@@ -36,7 +37,7 @@ export default function Blue() {
return( return(
<SafeAreaView> <SafeAreaView>
<View style={{flexDirection: "column"}}> <View style={{flexDirection: "column"}}>
<ImageBackground style={styles.image} source={require("../assets/game/gameback.png")}> <ImageBackground style={styles.image} source={require("../../assets/game/gameback.png")}>
<View> <View>
...@@ -44,15 +45,15 @@ export default function Blue() { ...@@ -44,15 +45,15 @@ export default function Blue() {
<Text style={styles.text}>Say the name of this color?</Text> <Text style={styles.text}>Say the name of this color?</Text>
</View> </View>
<Image style={styles.robo} source={require("../assets/game/robo.png")}></Image> <Image style={styles.robo} source={require("../../assets/game/robo.png")}></Image>
</View> </View>
<View> <View>
<Image style={styles.blackboard} source={require("../assets/game/blackboard.png")}></Image> <Image style={styles.blackboard} source={require("../../assets/game/blackboard.png")}></Image>
<View style={styles.box}> <View style={{width: 180, height: 180, backgroundColor: backColor, marginTop: -370, marginLeft: 455, borderRadius: 100}}>
</View> </View>
</View> </View>
...@@ -77,16 +78,6 @@ const styles = StyleSheet.create({ ...@@ -77,16 +78,6 @@ const styles = StyleSheet.create({
width: "100%", width: "100%",
height: "100%", height: "100%",
}, },
box: {
width: 180,
height: 180,
// borderColor: "#000000",
backgroundColor: "blue",
marginTop: -370,
marginLeft: 455,
borderRadius: 100
},
blackboard: { blackboard: {
marginTop: -420, marginTop: -420,
marginLeft: 240, marginLeft: 240,
......
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import Orientation from 'react-native-orientation-locker';
import React from "react"; import React from "react";
import { SafeAreaView, ScrollView, View, StyleSheet, ImageBackground, Text, TextInput, TouchableOpacity, Image } from "react-native"; import { SafeAreaView, ScrollView, View, StyleSheet, ImageBackground, Text, TextInput, TouchableOpacity, Image } from "react-native";
...@@ -6,6 +7,14 @@ const Login = () => { ...@@ -6,6 +7,14 @@ const Login = () => {
const navigation = useNavigation(); const navigation = useNavigation();
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
return( return(
<SafeAreaView> <SafeAreaView>
<ScrollView> <ScrollView>
......
import React from "react"; import React from "react";
import Orientation from 'react-native-orientation-locker';
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import { SafeAreaView, ScrollView, View, StyleSheet, ImageBackground, Text, TextInput, TouchableOpacity, Image } from "react-native"; import { SafeAreaView, ScrollView, View, StyleSheet, ImageBackground, Text, TextInput, TouchableOpacity, Image } from "react-native";
...@@ -6,6 +7,14 @@ const Register = () => { ...@@ -6,6 +7,14 @@ const Register = () => {
const navigation = useNavigation(); const navigation = useNavigation();
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
return( return(
<SafeAreaView> <SafeAreaView>
<ScrollView> <ScrollView>
......
import React from "react"; import React from "react";
import { StyleSheet, View, Text, Pressable, SafeAreaView, ScrollView, Image } from 'react-native'; import { StyleSheet, View, Text, Pressable, SafeAreaView, ScrollView, Image } from 'react-native';
import Orientation from 'react-native-orientation-locker';
import ImageButton from "../component/ImageButton"; import ImageButton from "../component/ImageButton";
export default function Home({ navigation }){ export default function Home({ navigation }){
...@@ -8,6 +9,14 @@ export default function Home({ navigation }){ ...@@ -8,6 +9,14 @@ export default function Home({ navigation }){
navigation.navigate('Start'); navigation.navigate('Start');
} }
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
return ( return (
<SafeAreaView> <SafeAreaView>
<ScrollView> <ScrollView>
......
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import Orientation from 'react-native-orientation-locker';
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { Image, View, Text} from "react-native"; import { Image, View, Text} from "react-native";
const Splash = () => { const Splash = () => {
const navigation = useNavigation();
const [isGo,setIsGo] = useState(true); const [isGo,setIsGo] = useState(true);
const Navigation = useNavigation(); const Navigation = useNavigation();
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
useEffect( ()=>{ useEffect( ()=>{
if(isGo == true){ if(isGo == true){
......
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