Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
21_22-J 38
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
21_22-J 38
21_22-J 38
Commits
2294ffe2
Commit
2294ffe2
authored
Apr 24, 2022
by
W.D.R.P. Sandeepa
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'it18218640' into 'master'
change activity interface See merge request
!140
parents
33fe1ad6
5b597f99
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
46 deletions
+96
-46
API/app.py
API/app.py
+4
-9
API/model.h5
API/model.h5
+0
-0
frontend/src/assets/game/mic2.png
frontend/src/assets/game/mic2.png
+0
-0
frontend/src/assets/game/next.png
frontend/src/assets/game/next.png
+0
-0
frontend/src/screen/activity/Blue.js
frontend/src/screen/activity/Blue.js
+87
-34
frontend/src/screen/auth/Login.js
frontend/src/screen/auth/Login.js
+2
-2
frontend/src/screen/auth/Register.js
frontend/src/screen/auth/Register.js
+2
-0
frontend/src/screen/client/Client.js
frontend/src/screen/client/Client.js
+1
-1
No files found.
API/app.py
View file @
2294ffe2
...
...
@@ -13,7 +13,6 @@ from API.routers.router import funtion_one
app
=
Flask
(
__name__
)
# Initial Route
@
app
.
route
(
"/"
)
def
home
():
...
...
@@ -46,6 +45,8 @@ def home():
# return msg
# Color Function Route (IT18218640)
# Get Color activities route
@
app
.
route
(
"/getColorActivities1"
)
def
getColorActivities1
():
return
get_color_activities1
()
...
...
@@ -100,17 +101,11 @@ def getColorActivitiesResult():
# Read Function Route (IT)
@
app
.
route
(
"/testings"
)
def
checkothers
():
return
"testing funtions"
# Color Function Route (IT18218640)
@
app
.
route
(
"/reading"
)
def
getReadActivities
():
return
get_reading_activities
()
@
app
.
route
(
"/ru"
)
def
abc
():
response_val
=
funtion_one
()
...
...
@@ -146,4 +141,4 @@ def login():
if
__name__
==
"__main__"
:
# app.run(host='192.168.8.101')
# app.run(host='192.168.8.100,port='5000', debug=True)
app
.
run
(
debug
=
True
)
app
.
run
(
debug
=
True
)
\ No newline at end of file
API/model.h5
0 → 100644
View file @
2294ffe2
File added
frontend/src/assets/game/mic2.png
0 → 100644
View file @
2294ffe2
238 KB
frontend/src/assets/game/next.png
0 → 100644
View file @
2294ffe2
20.3 KB
frontend/src/screen/activity/Blue.js
View file @
2294ffe2
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
{
Text
,
TouchableOpacity
,
StyleSheet
,
View
,
Dimensions
,
SafeAreaView
,
ImageBackground
,
Button
,
Image
,
StatusBar
}
from
'
react-native
'
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
Text
,
TouchableOpacity
,
StyleSheet
,
View
,
Dimensions
,
SafeAreaView
,
ImageBackground
,
Button
,
Image
,
StatusBar
}
from
'
react-native
'
import
Permissions
from
'
react-native-permissions
'
;
import
AudioRecord
from
'
react-native-audio-record
'
;
import
axios
from
"
axios
"
;
import
client
from
"
../client/Client
"
;
import
BackButton
from
"
../../component/BackButton
"
export
default
function
Blue
(
color
)
{
const
navigation
=
useNavigation
();
...
...
@@ -46,7 +31,6 @@ export default function Blue(color) {
return
unsubscribe
;
},
[
navigation
]);
// audioInit
function
audioInit
()
{
// console.log('audioInit');
...
...
@@ -61,10 +45,9 @@ export default function Blue(color) {
AudioRecord
.
init
(
colorAudio
);
}
// checkPermission
async
function
checkPermission
()
{
// console.log('checkPermission');
const
p
=
await
Permissions
.
check
(
'
microphone
'
);
// console.log(p);
// console.log('permission check', p);
...
...
@@ -79,13 +62,11 @@ export default function Blue(color) {
}
// requestPermission
async
function
requestPermission
()
{
const
p
=
await
Permissions
.
request
(
'
microphone
'
);
// console.log('permission request', p);
}
// audioStart
async
function
audioStart
()
{
// console.log('audioStart');
...
...
@@ -96,7 +77,6 @@ export default function Blue(color) {
},
2000
);
}
// audioStop
async
function
audioStop
()
{
// console.log('audioStop');
...
...
@@ -104,12 +84,66 @@ export default function Blue(color) {
let
audioFile
=
await
AudioRecord
.
stop
();
console
.
log
(
'
userFile
'
,
audioFile
);
//
call sendAudio funtion
send
Audio
(
audioFile
);
//
sendAudio(audioFile);
get
Audio
(
audioFile
);
}
// send audio to server function
function
getAudio
(
audioFile
)
{
const
formData
=
new
FormData
();
var
obj
=
{
uri
:
`file://
${
audioFile
}
`
,
type
:
'
audio/wav
'
,
name
:
'
color.wav
'
,
colorNmae
:
backColor
}
// formData.append(
// 'file',
// {
// uri: `file://${audioFile}`,
// type: 'audio/wav',
// name: 'color.wav',
// }
// );
// formData.append(
// 'name', backColor
// );
var
data
=
JSON
.
stringify
(
obj
)
console
.
log
(
data
);
axios
.
post
(
"
http://192.168.8.102:5000/predict
"
,
data
,
{
headers
:
{
Accept
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
},
})
.
then
((
response
)
=>
{
// setNames(response.data);
console
.
log
(
'
Success part :
'
,
response
.
data
);
})
.
catch
(
function
(
error
)
{
if
(
error
.
response
)
{
console
.
log
(
'
Error data :
'
,
error
.
response
.
data
);
console
.
log
(
'
Error status :
'
,
error
.
response
.
status
);
console
.
log
(
'
Error headers :
'
,
error
.
response
.
headers
);
}
else
if
(
error
.
request
)
{
console
.
log
(
'
Error request :
'
,
error
.
request
);
}
else
{
console
.
log
(
'
Error message :
'
,
error
.
message
);
}
console
.
log
(
'
Error else part :
'
,
error
.
config
);
});
}
async
function
sendAudio
(
audioFile
)
{
// append form data and upload to api
...
...
@@ -193,16 +227,34 @@ export default function Blue(color) {
<
/View
>
<
View
style
=
{{
flexDirection
:
"
row
"
,
marginLeft
:
480
}}
>
<
Button
style
=
{
styles
.
button
}
title
=
"
Recode
"
onPress
=
{()
=>
{
audioStart
();
}}
/
>
<
Button
title
=
"
Return
"
color
=
"
#1DCE92
"
/>
<
Button
title
=
"
Exit
"
color
=
"
#841584
"
/>
<
View
style
=
{{
marginTop
:
10
}}
>
<
BackButton
path
=
"
Color
"
/>
<
/View
>
<
View
style
=
{{
flexDirection
:
"
row
"
,
marginLeft
:
420
,
marginTop
:
-
80
}}
>
<
View
style
=
{{}}
>
<
TouchableOpacity
onPress
=
{()
=>
{
audioStart
();
}}
style
=
{{
width
:
"
30%
"
,
height
:
"
40%
"
,
borderRadius
:
50
}}
>
<
Image
source
=
{
require
(
'
../../assets/game/mic2.png
'
)}
resizeMode
=
'
contain
'
style
=
{{
flex
:
1
,
marginLeft
:
-
190
}}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{{
marginLeft
:
-
100
}}
>
<
TouchableOpacity
onPress
=
{()
=>
{
}}
style
=
{{
width
:
"
60%
"
,
height
:
"
40%
"
,
borderRadius
:
50
}}
>
<
Image
source
=
{
require
(
'
../../assets/game/next.png
'
)}
resizeMode
=
'
contain
'
style
=
{{
flex
:
.
9
,
marginLeft
:
-
90
}}
/
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/ImageBackground
>
<
/View
>
<
/SafeAreaView
>
)
}
const
styles
=
StyleSheet
.
create
({
...
...
@@ -244,7 +296,8 @@ const styles = StyleSheet.create({
button
:
{
padding
:
10
,
marginRight
:
50
,
color
:
"
#000000
"
color
:
"
#000000
"
,
marginLeft
:
50
,
}
})
\ No newline at end of file
frontend/src/screen/auth/Login.js
View file @
2294ffe2
...
...
@@ -93,13 +93,13 @@ const Login = () => {
<
/View
>
<
View
style
=
{
styles
.
form_input
}
>
<
TouchableOpacity
onPress
=
{
submitForm
}
style
=
{
styles
.
btn
}
>
<
TouchableOpacity
onPress
=
{
()
=>
{
navigation
.
navigate
(
"
Home
"
)}}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
btn_text
}
>
Sign
In
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
{
/* onPress={submitForm} */
}
<
View
style
=
{
styles
.
text_if
}
>
<
TouchableOpacity
onPress
=
{()
=>
{
navigation
.
navigate
(
"
Register
"
)}}
>
<
Text
style
=
{
styles
.
btn_text2
}
>
...
...
frontend/src/screen/auth/Register.js
View file @
2294ffe2
...
...
@@ -86,6 +86,8 @@ const Register = () => {
}
}
// import client from "../client/Client";
return
(
<
SafeAreaView
>
<
ScrollView
>
...
...
frontend/src/screen/client/Client.js
View file @
2294ffe2
import
axios
from
'
axios
'
;
export
default
axios
.
create
({
baseURL
:
'
http://192.168.8.101:5000/
'
,
timeout
:
15000
,
});
\ No newline at end of file
export
default
axios
.
create
({
baseURL
:
'
http://192.168.8.102:5000/
'
,
timeout
:
15000
,
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment