Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-029
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
2023-029
2023-029
Commits
54b2eedd
Commit
54b2eedd
authored
Aug 29, 2023
by
janithgamage1.ed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update
desc : update project
parent
44218348
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
19 deletions
+24
-19
Project/Backend/Server_Node/controllers/marksCalculator.controller.js
...end/Server_Node/controllers/marksCalculator.controller.js
+23
-18
Project/Backend/Server_Node/routes/marksCalculator.routes.js
Project/Backend/Server_Node/routes/marksCalculator.routes.js
+1
-1
No files found.
Project/Backend/Server_Node/controllers/marksCalculator.controller.js
View file @
54b2eedd
...
@@ -3,9 +3,12 @@ import { exec } from "child_process";
...
@@ -3,9 +3,12 @@ import { exec } from "child_process";
export
const
marksCalculator
=
async
(
req
,
res
)
=>
{
export
const
marksCalculator
=
async
(
req
,
res
)
=>
{
const
imageData
=
req
.
file
.
buffer
.
toString
(
'
base64
'
);
const
imageData
=
req
.
file
.
buffer
.
toString
(
'
base64
'
);
const
targetClass
=
req
.
body
.
class
;
const
targetClass
=
req
.
body
.
class
;
const
{
curriculumIndex
,
tutorialIndex
}
=
req
.
params
;
try
{
console
.
log
(
curriculumIndex
,
tutorialIndex
);
try
{
if
(
curriculumIndex
==
1
&&
tutorialIndex
==
1
)
{
// Run Python script to perform prediction
// Run Python script to perform prediction
const
pythonProcess
=
exec
(
'
python prediction_config/C1T1/predict.py
'
,
(
error
,
stdout
,
stderr
)
=>
{
const
pythonProcess
=
exec
(
'
python prediction_config/C1T1/predict.py
'
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
@@ -25,7 +28,9 @@ export const marksCalculator = async (req, res) => {
...
@@ -25,7 +28,9 @@ export const marksCalculator = async (req, res) => {
pythonProcess
.
stdin
.
write
(
`
${
imageData
}
\n
${
targetClass
}
`
);
pythonProcess
.
stdin
.
write
(
`
${
imageData
}
\n
${
targetClass
}
`
);
pythonProcess
.
stdin
.
end
();
pythonProcess
.
stdin
.
end
();
}
else
{
return
res
.
status
(
400
).
json
({
code
:
"
02
"
,
message
:
"
Curriculum Index or Tutorial Index Invalid
"
})
}
}
catch
(
error
)
{
}
catch
(
error
)
{
res
.
status
(
500
).
json
({
code
:
"
00
"
,
message
:
"
Something went wrong
"
})
res
.
status
(
500
).
json
({
code
:
"
00
"
,
message
:
"
Something went wrong
"
})
}
}
...
...
Project/Backend/Server_Node/routes/marksCalculator.routes.js
View file @
54b2eedd
...
@@ -8,6 +8,6 @@ const upload = multer({ storage: storage });
...
@@ -8,6 +8,6 @@ const upload = multer({ storage: storage });
const
router
=
express
.
Router
();
const
router
=
express
.
Router
();
router
.
post
(
'
/curriculum/
tutorial
'
,
upload
.
single
(
'
image
'
),
marksCalculator
)
router
.
post
(
'
/curriculum/
:curriculumIndex/tutorial/:tutorialIndex
'
,
upload
.
single
(
'
image
'
),
marksCalculator
)
export
default
router
;
export
default
router
;
\ 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