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

Merge branch 'master' into 'it18257632'

# Conflicts:
#   API/app.py
parents f1803cbb 214242e2
......@@ -6,7 +6,7 @@
<excludeFolder url="file://$MODULE_DIR$/API/venv" />
<excludeFolder url="file://$MODULE_DIR$/backend/IT18257632/venv" />
</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" />
</component>
</module>
\ 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" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
......@@ -45,6 +45,6 @@ def abc():
if __name__ == "__main__":
# app.run(host='192.168.1.101')
app.run(host='192.168.8.102')
# 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():
database="helply",
host="127.0.0.1",
user="root",
password="12345678"
password="rp19970520"
)
return db
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)
return db
......
......@@ -6,4 +6,5 @@ def get_color_activities():
response = get_all_data(qry)
return response
\ No newline at end of file
return response
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():
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}")
# print(f"{FPFN}")
# invoke keyword spotting service
kss = Keyword_Spotting_service()
......@@ -34,6 +34,6 @@ def predict():
return jsonify(data)
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(debug=False)
\ No newline at end of file
......@@ -3,6 +3,7 @@ import numpy as np
import tensorflow.keras as keras
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
from keras.callbacks import ModelCheckpoint
DATA_PATH = "data.json"
SAVE_MODEL_PATH = "model.h5"
......@@ -11,7 +12,7 @@ LEARNING_RATE = 0.0001
EPOCHS = 60
BATCH_SIZE = 32
NUM_KEYWORDS = 10
NUM_KEYWORDS = 6
def load_dataset(data_path):
......@@ -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.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
model.add(keras.layers.Dense(NUM_KEYWORDS, activation="softmax"))
......@@ -104,12 +111,15 @@ def main():
input_shape = (X_train.shape[1], X_train.shape[2], X_train.shape[3],)
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
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
test_error, test_accuracy = model.evaluate(X_test, y_test)
print(f"Test error: {test_error}, test accuracy: {test_accuracy}")
# test_error, test_accuracy = model.evaluate(X_test, y_test)
# print(f"Test error: {test_error}, test accuracy: {test_accuracy}")
# save the model
model.save(SAVE_MODEL_PATH)
......
import { useNavigation } from "@react-navigation/native";
import React from "react";
import React, {useEffect} from "react";
import {Text, TouchableOpacity, StyleSheet, View, Image} from 'react-native'
......@@ -10,7 +10,7 @@ export default function ColorActivity(props){
const navigation = useNavigation();
return(
<TouchableOpacity onPress={()=> {navigation.navigate("Blue")}}
<TouchableOpacity onPress={()=> {navigation.navigate("Blue", {color})}}
style={{
borderWidth: 5,
borderColor: color,
......
......@@ -8,7 +8,7 @@ import Register from '../screen/auth/Register';
import Login from '../screen/auth/Login';
import Splash from '../screen/splash/Splash';
import Color from '../screen/Color';
import Blue from '../screen/Blue';
import Blue from '../screen/activity/Blue';
import Read from '../screen/Read';
import ReadActivity from '../screen/activity/readActivity';
const Stack = createNativeStackNavigator();
......
......@@ -6,7 +6,7 @@ import { StyleSheet, View, Text, Pressable, SafeAreaView, ScrollView, Image, Ima
import ImageButton from "../component/ImageButton";
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(){
......
......@@ -18,9 +18,10 @@ import {
Image
} from 'react-native'
export default function Blue() {
export default function Blue(color) {
const navigation = useNavigation();
const backColor = color.route.params.color;
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
......@@ -36,7 +37,7 @@ export default function Blue() {
return(
<SafeAreaView>
<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>
......@@ -44,15 +45,15 @@ export default function Blue() {
<Text style={styles.text}>Say the name of this color?</Text>
</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>
<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>
......@@ -77,16 +78,6 @@ const styles = StyleSheet.create({
width: "100%",
height: "100%",
},
box: {
width: 180,
height: 180,
// borderColor: "#000000",
backgroundColor: "blue",
marginTop: -370,
marginLeft: 455,
borderRadius: 100
},
blackboard: {
marginTop: -420,
marginLeft: 240,
......
import { useNavigation } from "@react-navigation/native";
import Orientation from 'react-native-orientation-locker';
import React from "react";
import { SafeAreaView, ScrollView, View, StyleSheet, ImageBackground, Text, TextInput, TouchableOpacity, Image } from "react-native";
......@@ -6,6 +7,14 @@ const Login = () => {
const navigation = useNavigation();
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
return(
<SafeAreaView>
<ScrollView>
......
import React from "react";
import Orientation from 'react-native-orientation-locker';
import { useNavigation } from "@react-navigation/native";
import { SafeAreaView, ScrollView, View, StyleSheet, ImageBackground, Text, TextInput, TouchableOpacity, Image } from "react-native";
......@@ -6,6 +7,14 @@ const Register = () => {
const navigation = useNavigation();
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
return(
<SafeAreaView>
<ScrollView>
......
import React from "react";
import { StyleSheet, View, Text, Pressable, SafeAreaView, ScrollView, Image } from 'react-native';
import Orientation from 'react-native-orientation-locker';
import ImageButton from "../component/ImageButton";
export default function Home({ navigation }){
......@@ -8,6 +9,14 @@ export default function Home({ navigation }){
navigation.navigate('Start');
}
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
return (
<SafeAreaView>
<ScrollView>
......
import { useNavigation } from "@react-navigation/native";
import Orientation from 'react-native-orientation-locker';
import React, { useEffect, useState } from "react";
import { Image, View, Text} from "react-native";
const Splash = () => {
const navigation = useNavigation();
const [isGo,setIsGo] = useState(true);
const Navigation = useNavigation();
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
return unsubscribe;
}, [navigation]);
useEffect( ()=>{
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