Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-073
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
2022-073
2022-073
Commits
fc791a00
Commit
fc791a00
authored
Nov 14, 2022
by
AdithyaKahawanugoda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arithmetic activity fix
parent
ba96757f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
55 deletions
+34
-55
web-app/backend/server.py
web-app/backend/server.py
+9
-8
web-app/frontend/src/components/activities/reasoningIqEval/arithmetic/Arithmetic.jsx
...ents/activities/reasoningIqEval/arithmetic/Arithmetic.jsx
+12
-28
web-app/frontend/src/components/activities/reasoningIqEval/arithmetic/imageSet.js
...ponents/activities/reasoningIqEval/arithmetic/imageSet.js
+5
-0
web-app/frontend/src/components/activities/reasoningIqEval/pictureConcept/PictureConcept.jsx
...ivities/reasoningIqEval/pictureConcept/PictureConcept.jsx
+1
-6
web-app/frontend/src/components/activities/reasoningIqEval/recorder/Recorder.js
...omponents/activities/reasoningIqEval/recorder/Recorder.js
+7
-7
web-app/frontend/src/components/activities/reasoningIqEval/timer/Timer.jsx
...src/components/activities/reasoningIqEval/timer/Timer.jsx
+0
-6
No files found.
web-app/backend/server.py
View file @
fc791a00
...
...
@@ -409,23 +409,24 @@ def predictArithmetic():
candidateID
=
request
.
form
.
get
(
'candidateID'
)
print
(
questionIndex
)
if
file
is
None
or
file
.
filename
==
""
:
return
jsonify
({
'error: no file'
})
return
jsonify
({
"error"
:
"no file"
})
try
:
file
.
save
(
"./"
+
file
.
filename
)
prediction
=
transform_audio
(
file
.
filename
)
data
=
{
'prediction'
:
prediction
}
activityName
=
"Arithmetic"
analysis
=
reasoningIQScoreCalculator
(
activityName
,
questionIndex
,
prediction
)
db
.
db
[
'reasoningIQScore'
]
.
insert_one
({
"activityName"
:
"Arithmetic"
,
"activityName"
:
activityName
,
"candidateID"
:
candidateID
,
"questionIndex"
:
questionIndex
,
"transcription"
:
prediction
,
"score"
:
analysis
[
0
],
"expectedAnswer"
:
analysis
[
1
]
})
return
jsonify
(
data
)
return
jsonify
(
{
"msg"
:
"Prediction completed"
}
)
except
:
return
jsonify
({
'error: Error during pipeline execution'
})
return
jsonify
({
'result: test'
})
return
jsonify
({
"error"
:
"Error during pipeline execution"
})
@
app
.
route
(
'/mentalChromScores'
,
methods
=
[
'POST'
])
...
...
@@ -498,6 +499,6 @@ def predictKnowledgeIq():
# Running app
if
__name__
==
"__main__"
:
app
.
secret_key
=
os
.
urandom
(
24
)
app
.
run
(
host
=
"1
92.168.8.169
"
,
ssl_context
=
'adhoc'
,
debug
=
True
,
use_reloader
=
False
)
app
.
run
(
host
=
"1
72.20.10.2
"
,
ssl_context
=
'adhoc'
,
debug
=
True
,
use_reloader
=
False
)
flask_cors
.
CORS
(
app
,
expose_headers
=
'Authorization'
)
web-app/frontend/src/components/activities/reasoningIqEval/arithmetic/Arithmetic.jsx
View file @
fc791a00
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
"
react
"
;
import
"
./Arithmetic.css
"
;
import
Timer
from
"
../timer/Timer
"
;
import
{
RecordingHandler
}
from
"
../recorder/Recorder
"
;
import
{
imgSrcArray
}
from
"
./imageSet
"
;
const
Arithmetic
=
({
nextActivity
})
=>
{
const
effectRan
=
useRef
(
false
);
const
[
allCompleted
,
setAllCompleted
]
=
useState
(
false
);
const
[
activityIndex
,
setActivityIndex
]
=
useState
(
1
);
const
imgSrcArray
=
[
"
https://i.ibb.co/10pQ5gp/image-27.png
"
,
"
https://i.ibb.co/4KGpx50/Screenshot-2022-10-10-232236.jpg
"
,
"
https://i.ibb.co/Bckx5FR/arithmatic3.png
"
,
];
const
switchActivityHandler
=
()
=>
{
if
(
activityIndex
<
3
)
{
let
activityNo
=
activityIndex
+
1
;
setActivityIndex
(
activityNo
);
RecordingHandler
(
`PC.wav`
,
activityNo
,
"
pc
"
);
}
else
{
setAllCompleted
(
true
);
}
};
useEffect
(()
=>
{
RecordingHandler
(
`AR.wav`
,
activityIndex
,
"
ar
"
);
// RecordingHandler(`AR.wav`, activityIndex, "ar");
if
(
effectRan
.
current
===
false
)
{
RecordingHandler
(
`AR.wav`
,
activityIndex
,
"
ar
"
);
return
()
=>
{
console
.
log
(
"
unmounted
"
);
effectRan
.
current
=
true
;
};
}
},
[
activityIndex
]);
useEffect
(()
=>
{
...
...
@@ -42,27 +47,6 @@ const Arithmetic = ({ nextActivity }) => {
/>
</
div
>
)
}
{
allCompleted
&&
(
<
div
className=
"w-4/6 h-4/6 m-auto"
>
{
"
"
}
<
img
className=
"m-auto"
src=
"https://i.ibb.co/sJWJZsD/completed.png"
alt=
"pattern"
/>
</
div
>
)
}
{
allCompleted
&&
(
<
button
className=
"float-right bg-transparent hover:bg-red-500 text-red-700 font-semibold hover:text-white py-2 px-4 border border-red-500 hover:border-transparent rounded"
onClick=
{
()
=>
{
nextActivity
();
}
}
>
Next Activity
</
button
>
)
}
{
!
allCompleted
&&
<
Timer
switchActivity=
{
switchActivityHandler
}
/>
}
</
div
>
);
...
...
web-app/frontend/src/components/activities/reasoningIqEval/arithmetic/imageSet.js
0 → 100644
View file @
fc791a00
export
const
imgSrcArray
=
[
"
https://i.ibb.co/10pQ5gp/image-27.png
"
,
"
https://i.ibb.co/4KGpx50/Screenshot-2022-10-10-232236.jpg
"
,
"
https://i.ibb.co/Bckx5FR/arithmatic3.png
"
,
];
web-app/frontend/src/components/activities/reasoningIqEval/pictureConcept/PictureConcept.jsx
View file @
fc791a00
...
...
@@ -99,12 +99,7 @@ const PictureConcept = ({ nextActivity }) => {
Next Activity
</
button
>
)
}
{
!
allCompleted
&&
(
<
Timer
activityIndex=
{
activityIndex
}
switchActivity=
{
switchActivityHandler
}
/>
)
}
{
!
allCompleted
&&
<
Timer
switchActivity=
{
switchActivityHandler
}
/>
}
{
!
allCompleted
&&
<
div
></
div
>
}
</
div
>
);
...
...
web-app/frontend/src/components/activities/reasoningIqEval/recorder/Recorder.js
View file @
fc791a00
...
...
@@ -67,12 +67,12 @@ const uploadRecording = async (file, fileName, questionIndex, activityName) => {
});
}
if
(
activityName
===
"
ar
"
)
{
//
await API.post(`predictArithmetic`, data, config)
//
.then((res) => {
// console.log(res, "DONE" + new Date().toISOString
);
//
})
//
.catch((err) => {
// console.log(err, "ERROR" + new Date().toISOString
);
//
});
await
API
.
post
(
`predictArithmetic`
,
data
,
config
)
.
then
((
res
)
=>
{
console
.
log
(
res
,
"
DONE
"
);
})
.
catch
((
err
)
=>
{
console
.
log
(
err
,
"
ERROR
"
);
});
}
};
web-app/frontend/src/components/activities/reasoningIqEval/timer/Timer.jsx
View file @
fc791a00
...
...
@@ -21,13 +21,7 @@ const Timer = ({ switchActivity }) => {
rotation=
{
"
counterclockwise
"
}
size=
{
100
}
strokeWidth=
{
8
}
onUpdate=
{
(
remainingTime
)
=>
{
if
(
remainingTime
===
15
)
{
console
.
log
(
"
TIMER START
"
);
}
}
}
onComplete=
{
()
=>
{
console
.
log
(
"
TIMER STOP
"
);
// change activity
switchActivity
();
return
{
shouldRepeat
:
true
,
delay
:
0
};
// repeat animation in 1.5 seconds
...
...
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