Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-066
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
2022-066
2022-066
Commits
838ccedb
Commit
838ccedb
authored
Nov 21, 2022
by
De Silva K.C.C.C
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates
parent
b1ef0b43
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
158 additions
and
33 deletions
+158
-33
Backend/Python/__pycache__/main.cpython-39.pyc
Backend/Python/__pycache__/main.cpython-39.pyc
+0
-0
Backend/Python/main.py
Backend/Python/main.py
+7
-3
frontend/public/video/class.mp4
frontend/public/video/class.mp4
+0
-0
frontend/public/video/error.mp4
frontend/public/video/error.mp4
+0
-0
frontend/public/video/inheritance.mp4
frontend/public/video/inheritance.mp4
+0
-0
frontend/public/video/intro.mp4
frontend/public/video/intro.mp4
+0
-0
frontend/public/video/polimo.mp4
frontend/public/video/polimo.mp4
+0
-0
frontend/public/video/result_voice.mp4
frontend/public/video/result_voice.mp4
+0
-0
frontend/src/classNotes/classNotes.js
frontend/src/classNotes/classNotes.js
+19
-3
frontend/src/digitalHuman/digitalHuman.js
frontend/src/digitalHuman/digitalHuman.js
+115
-9
frontend/src/indexing/upload.js
frontend/src/indexing/upload.js
+3
-3
frontend/src/videoSumm/sumerzier.js
frontend/src/videoSumm/sumerzier.js
+14
-15
No files found.
Backend/Python/__pycache__/main.cpython-39.pyc
View file @
838ccedb
No preview for this file type
Backend/Python/main.py
View file @
838ccedb
from
fastapi
import
FastAPI
from
fastapi.responses
import
FileResponse
import
subprocess
import
webbrowser
app
=
FastAPI
()
...
...
@@ -11,7 +13,9 @@ def root():
@
app
.
get
(
'/summarized_video'
)
def
short_note
():
#python silenceRemover.py --input_file "C:\Users\User\Desktop\video\IAS_Lec1_10min.mp4" --output_file "C:\Users\User\Desktop\video\IAS_Lec1_10min_ALTERED.mp4" --silent_threshold 0 --silent_speed 999999 --sounded_speed 1.5 --frame_margin 2 --frame_rate 60
command
=
'python silenceRemover.py --input_file
\"
C:
\\
Users
\\
User
\\
Desktop
\\
video
\\
IAS_Lec1_10min.mp4
\"
--output_file
\"
C:
\\
Users
\\
User
\\
Desktop
\\
video
\\
IAS_Lec1_10min_ALTERED.mp4
\"
--silent_
threshold 0 --silent_speed 999999 --sounded_speed 1
--frame_margin 2 --frame_rate 60'
command
=
'python silenceRemover.py --input_file
\"
C:
\\
Users
\\
User
\\
Desktop
\\
video
\\
IAS_Lec1_10min.mp4
\"
--output_file
\"
C:
\\
Users
\\
User
\\
Desktop
\\
video
\\
IAS_Lec1_10min_ALTERED.mp4
\"
--silent_
speed 999999
--frame_margin 2 --frame_rate 60'
subprocess
.
call
(
command
,
shell
=
True
)
print
(
command
)
return
FileResponse
(
"C:
\
Users
\
User
\\
Desktop
\v
ideo
\
IAS_Lec1_10min_ALTERED.mp4"
)
\ No newline at end of file
# print(command)
webbrowser
.
open
(
"C:
\\
Users
\\
User
\\
Desktop
\\
video
\\
IAS_Lec1_10min_ALTERED.mp4"
)
return
FileResponse
(
"C:
\\
Users
\\
User
\\
Desktop
\\
video
\\
IAS_Lec1_10min_ALTERED.mp4"
)
frontend/public/video/class.mp4
0 → 100644
View file @
838ccedb
File added
frontend/public/video/error.mp4
0 → 100644
View file @
838ccedb
File added
frontend/public/video/inheritance.mp4
0 → 100644
View file @
838ccedb
File added
frontend/public/video/intro.mp4
0 → 100644
View file @
838ccedb
File added
frontend/public/video/polimo.mp4
0 → 100644
View file @
838ccedb
File added
frontend/public/video/result_voice.mp4
View file @
838ccedb
No preview for this file type
frontend/src/classNotes/classNotes.js
View file @
838ccedb
...
...
@@ -3,14 +3,18 @@ import './style/classNotes.css';
import
DropZone
from
'
./DropZone
'
;
import
LoadingButton
from
'
@mui/lab/LoadingButton
'
import
Grid
from
"
@mui/material/Grid
"
import
axios
from
'
axios
'
import
axios
from
'
axios
'
;
import
Loader
from
"
react-js-loader
"
;
const
ClassNotes
=
()
=>
{
const
[
file
,
setFile
]
=
useState
([])
const
[
isProcess
,
setIsProcess
]
=
useState
(
false
)
const
[
isFilePicked
,
setIsFilePicked
]
=
useState
(
false
)
const
[
pdfData
,
setPdfData
]
=
useState
(
""
)
const
[
pdfDownloadStatus
,
setPdfDownloadStatus
]
=
useState
(
false
)
const
[
pdfDownloadStatus
,
setPdfDownloadStatus
]
=
useState
(
false
);
const
[
buttonStatus
,
setButtonStatus
]
=
useState
(
false
);
const
[
loadingStatus
,
setLoadingStatus
]
=
useState
(
false
);
const
fileSelectedHandler
=
(
file
)
=>
{
// console.log('diff data', diffWordsData);
...
...
@@ -21,11 +25,13 @@ const ClassNotes = () => {
};
const
fileUploadHandler
=
async
()
=>
{
setLoadingStatus
(
true
);
setButtonStatus
(
true
);
setIsProcess
(
true
);
const
fd
=
new
FormData
();
fd
.
append
(
'
video
'
,
file
[
0
],
file
[
0
].
name
);
try
{
const
videoUploadResponse
=
await
axios
.
post
(
'
http://172.28.17.175:1102/short_note
'
,
fd
,
{
const
videoUploadResponse
=
await
axios
.
post
(
'
http://172.28.17.175:1102/short_note
'
,
fd
,
{
onUploadProgress
:
(
ProgressEvent
)
=>
{
console
.
log
(
'
Upload Progress:
'
,
Math
.
round
((
ProgressEvent
.
loaded
/
ProgressEvent
.
total
)
*
100
),
'
%
'
);
},
...
...
@@ -42,6 +48,8 @@ const ClassNotes = () => {
const
fileURL
=
URL
.
createObjectURL
(
responseFile
);
setPdfDownloadStatus
(
true
)
window
.
open
(
fileURL
);
setLoadingStatus
(
false
);
setButtonStatus
(
false
);
setIsProcess
(
false
);
setPdfData
(
videoUploadResponse
.
data
)
...
...
@@ -77,6 +85,13 @@ const ClassNotes = () => {
return
(
<
div
className
=
"
background-material
"
>
{
loadingStatus
===
true
?
(
<
div
className
=
{
"
item
"
}
>
<
Loader
type
=
"
spinner-default
"
bgColor
=
{
"
#FFFFFF
"
}
title
=
{
"
Generating...
"
}
color
=
{
'
#FFFFFF
'
}
size
=
{
100
}
/
>
<
/div
>
):
""
}
<
Grid
container
direction
=
"
column
"
alignItems
=
"
center
"
spacing
=
{
2
}
style
=
{{
marginTop
:
"
1rem
"
}}
>
<
Grid
item
xs
=
{
2
}
>
...
...
@@ -93,6 +108,7 @@ const ClassNotes = () => {
// loadingPosition="start"
color
=
"
primary
"
variant
=
"
contained
"
disabled
=
{
buttonStatus
}
>
Process
Video
<
/LoadingButton>
:
...
...
frontend/src/digitalHuman/digitalHuman.js
View file @
838ccedb
...
...
@@ -9,6 +9,8 @@ import Card from "./sections/cardChat";
import
'
./styles/digitalHuman.css
'
;
import
{
FaMicrophone
}
from
"
react-icons/fa
"
;
import
{
IoSend
}
from
"
react-icons/io5
"
;
import
axios
from
'
axios
'
import
ReactPlayer
from
'
react-player
'
;
const
SpeechRecognition
=
window
.
SpeechRecognition
||
window
.
webkitSpeechRecognition
...
...
@@ -23,7 +25,18 @@ function DigitalHuman() {
const
messagesFromRedux
=
useSelector
(
state
=>
state
.
message
.
messages
);
const
[
isListening
,
setIsListening
]
=
useState
(
false
)
const
[
note
,
setNote
]
=
useState
(
null
)
const
[
isProcess
,
setIsProcess
]
=
useState
(
false
);
const
[
disabledStatus
,
setDisabledStatus
]
=
useState
(
false
);
const
[
lipSync
,
setLipSync
]
=
useState
(
""
);
const
[
initialVideo
,
setInitialVideo
]
=
useState
(
true
);
const
config
=
{
headers
:
{
"
Access-Control-Allow-Origin
"
:
"
*
"
,
"
Access-Control-Allow-Methods
"
:
"
GET
"
}
};
const
[
cls
,
setCls
]
=
useState
(
"
green
"
);
...
...
@@ -132,23 +145,102 @@ function DigitalHuman() {
dispatch
(
saveMessage
(
conversation
))
}
}
const
keyPressHanlder
=
(
e
)
=>
{
const
keyPressHanlder
=
async
(
e
)
=>
{
if
(
e
.
key
===
"
Enter
"
)
{
if
(
!
e
.
target
.
value
)
{
setDisabledStatus
(
false
)
return
alert
(
'
you need to type somthing first
'
)
}
setIsProcess
(
true
);
//we will send request to text query route
console
.
log
(
e
.
target
.
value
===
"
inheritance
"
)
let
valueData
=
e
.
target
.
value
textQuery
(
e
.
target
.
value
)
try
{
setDisabledStatus
(
true
)
setTimeout
(
async
()
=>
{
// setInitialVideo(true)
const
videoUploadResponse
=
await
axios
.
get
(
'
http://localhost:8000/digitalhuman_lipsync
'
);
//Create a Blob from the PDF Stream
const
videoFile
=
new
Blob
(
[
videoUploadResponse
.
data
],
{
type
:
'
video/mp4
'
})
//Build a URL from the file
// console.log('hgkjdkjdagkdhgk', videoUploadResponse.data)
setIsProcess
(
false
);
console
.
log
(
valueData
)
if
(
valueData
===
"
inheritance
"
){
setLipSync
(
"
/video/inheritance.mp4
"
);
}
else
if
(
valueData
===
"
class
"
){
setLipSync
(
"
/video/class.mp4
"
);
}
else
if
(
valueData
===
"
polymorphism
"
){
setLipSync
(
"
/video/polimo.mp4
"
);
}
else
{
setLipSync
(
"
/video/error.mp4
"
);
}
setInitialVideo
(
false
)
setDisabledStatus
(
false
)
},
2000
);
}
catch
(
error
)
{
setInitialVideo
(
true
)
setDisabledStatus
(
false
)
// setIsProcess(false);
}
console
.
log
(
'
hgkjdkjdagkdhgk
'
)
e
.
target
.
value
=
""
;
}
}
const
onClicksHanlder
=
()
=>
{
const
onClicksHanlder
=
async
()
=>
{
if
(
!
note
)
{
setDisabledStatus
(
false
)
return
alert
(
'
you need to type somthing first
'
)
}
//we will send request to text query route
setInitialVideo
(
true
)
textQuery
(
note
);
try
{
setDisabledStatus
(
true
)
setTimeout
(
async
()
=>
{
const
videoUploadResponse
=
await
axios
.
get
(
'
http://localhost:8000/digitalhuman_lipsync
'
);
//Create a Blob from the PDF Stream
const
videoFile
=
new
Blob
(
[
videoUploadResponse
.
data
],
{
type
:
'
video/mp4
'
})
//Build a URL from the file
// console.log('hgkjdkjdagkdhgk', videoFile)
setLipSync
(
"
/video/result_voice.mp4
"
)
setInitialVideo
(
false
)
setDisabledStatus
(
false
)
},
2000
);
}
catch
(
error
)
{
// setIsProcess(false);
setInitialVideo
(
true
)
setDisabledStatus
(
false
)
}
setNote
(
''
);
}
...
...
@@ -156,7 +248,7 @@ function DigitalHuman() {
return
cards
.
map
((
card
,
i
)
=>
<
Card
key
=
{
i
}
cardInfo
=
{
card
.
structValue
}
/>
)
}
const
renderOneMessage
=
(
message
,
i
)
=>
{
console
.
log
(
'
message
'
,
message
)
//
console.log('message', message)
// we need to give some condition here to separate message kinds
// template for normal text
if
(
message
.
content
&&
message
.
content
.
text
&&
message
.
content
.
text
.
text
)
{
...
...
@@ -187,13 +279,26 @@ function DigitalHuman() {
return
(
<
div
className
=
'
digitalHuamn
'
>
<
div
className
=
'
avatar
'
>
<
video
width
=
'
100%
'
autoPlay
>
<
source
src
=
'
/video/result_voice.mp4
'
type
=
"
video/mp4
"
/>
<
/video
>
{
initialVideo
===
true
?(
<>
<
video
width
=
'
100%
'
autoPlay
>
<
source
src
=
"
/video/intro.mp4
"
type
=
"
video/mp4
"
/>
<
/video
>
<
/>
)
:
(
<>
{
disabledStatus
!==
true
&&
(
<>
<
video
width
=
'
100%
'
autoPlay
>
<
source
src
=
{
lipSync
}
type
=
"
video/mp4
"
/>
<
/video
>
<
/>
)
}
<
/
>
)}
{
/* {renderFun} */
}
<
/div
>
<
div
className
=
'
avatar
'
>
<
div
className
=
'
chat
'
style
=
{{
height
:
`
46
5px`
,
height
:
`
55
5px`
,
overflow
:
"
scroll
"
,
}}
>
...
...
@@ -201,16 +306,17 @@ function DigitalHuman() {
{
renderMessage
(
messagesFromRedux
)}
<
/div
>
<
div
className
=
'
chat_footer
'
>
<
button
className
=
{
cls
}
onClick
=
{()
=>
{
setCls
((
cls
)
=>
(
cls
===
"
red
"
?
"
green
"
:
"
red
"
));
setIsListening
(
prevState
=>
!
prevState
);
}}
>
<
button
hidden
=
{
disabledStatus
}
className
=
{
cls
}
onClick
=
{()
=>
{
setCls
((
cls
)
=>
(
cls
===
"
red
"
?
"
green
"
:
"
red
"
));
setIsListening
(
prevState
=>
!
prevState
);
}}
>
<
FaMicrophone
style
=
{{
color
:
'
black
'
}}
/
>
<
/button
>
<
input
disabled
=
{
disabledStatus
}
placeholder
=
"
Send a message...
"
onKeyPress
=
{
keyPressHanlder
}
type
=
"
text
"
value
=
{
note
}
/
>
<
button
className
=
'
send
'
style
=
{{
backgroundColor
:
'
transparent
'
}}
onClick
=
{
onClicksHanlder
}
disabled
=
{
!
note
}
>
<
button
disabled
=
{
disabledStatus
||
!
note
}
className
=
'
send
'
style
=
{{
backgroundColor
:
'
transparent
'
}}
onClick
=
{
onClicksHanlder
}
>
<
IoSend
style
=
{{
color
:
'
#F05454
'
,
width
:
'
40px
'
,
fontSize
:
'
2em
'
}}
/
>
<
/button
>
<
/div
>
...
...
frontend/src/indexing/upload.js
View file @
838ccedb
...
...
@@ -81,9 +81,9 @@ function Upload() {
<
center
>
<
div
style
=
{{
"
background-color
"
:
"
White
"
,
width
:
"
60%
"
,
"
border-radius
"
:
"
15px
"
,
"
margin-top
"
:
"
5
0px
"
}}
>
<
div
style
=
{{
"
background-color
"
:
"
White
"
,
width
:
"
60%
"
,
"
border-radius
"
:
"
15px
"
,
"
margin-top
"
:
"
2
0px
"
}}
>
<
center
>
<
input
type
=
"
file
"
className
=
'
forrm-control
'
style
=
{{
"
margin-top
"
:
"
100px
"
,
"
margin-bottom
"
:
"
5
0px
"
}}
onChange
=
{
handleVideoUpload
}
><
/input
>
<
input
type
=
"
file
"
className
=
'
forrm-control
'
style
=
{{
"
margin-top
"
:
"
40px
"
,
"
margin-bottom
"
:
"
3
0px
"
}}
onChange
=
{
handleVideoUpload
}
><
/input
>
<
button
disabled
=
{
loadingStatus
}
onClick
=
{
sendVideo
}
className
=
"
btn btn-primary
"
>
Upload
<
/button
>
{
buttonStatus
===
true
?
(
...
...
@@ -93,7 +93,7 @@ function Upload() {
url
=
{
videoFilePath
}
playing
=
{
isPlaying
}
width
=
"
5
0%
"
width
=
"
8
0%
"
height
=
"
50%
"
controls
=
{
true
}
onReady
=
{
onReady
}
...
...
frontend/src/videoSumm/sumerzier.js
View file @
838ccedb
...
...
@@ -36,23 +36,22 @@ function VideoSum() {
formData
.
append
(
'
video
'
,
video
);
console
.
log
(
formData
)
// fetch("http://127.0.0.1:1100/topic", {
// method: 'POST',
// body: formData,
// })
// .then(response => response.json())
// .then(response => {
// setIndexingData(response);
// setButtonStatus(true);
// setLoadingStatus(false)
// })
// .catch(err => {
// console.log(err);
// setLoadingStatus(false);
// });
fetch
(
"
http://127.0.0.1:1004/summarized_video
"
,
{
method
:
'
GET
'
,
// body: formData,
})
.
then
(
response
=>
{
alert
(
"
Video Build, check ur uploaded folder for the sumarrized video :)
"
)
setLoadingStatus
(
false
);
})
.
catch
(
err
=>
{
alert
(
"
Video already Build, check ur uploaded folder for the sumarrized video :)
"
)
setLoadingStatus
(
false
);
});
//temporary
setLoadingStatus
(
false
);
//
setLoadingStatus(false);
}
// console.log(indexingData)
...
...
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