Commit 4832b594 authored by Paranagama R.P.S.D.'s avatar Paranagama R.P.S.D.

feat : Conversion with speed value

parent 5255e52b
...@@ -31,3 +31,9 @@ ...@@ -31,3 +31,9 @@
2023-07-12 06:39:07,180 - INFO - Error. 2023-07-12 06:39:07,180 - INFO - Error.
2023-07-12 06:39:07,180 - INFO - Error. 2023-07-12 06:39:07,180 - INFO - Error.
2023-07-12 06:39:07,180 - INFO - Error. 2023-07-12 06:39:07,180 - INFO - Error.
2023-08-03 06:00:41,581 - INFO - Failed to make predictions. [WinError 32] The process cannot access the file because it is being used by another process: 'files/test_video.mp4'
2023-08-03 06:00:41,581 - INFO - Failed to make predictions. [WinError 32] The process cannot access the file because it is being used by another process: 'files/test_video.mp4'
2023-08-03 06:00:41,581 - INFO - Failed to make predictions. [WinError 32] The process cannot access the file because it is being used by another process: 'files/test_video.mp4'
2023-08-03 06:00:41,626 - INFO - Error.
2023-08-03 06:00:41,626 - INFO - Error.
2023-08-03 06:00:41,626 - INFO - Error.
...@@ -21,6 +21,7 @@ import { ...@@ -21,6 +21,7 @@ import {
Paper, Paper,
CircularProgress, CircularProgress,
LinearProgress, LinearProgress,
Slider,
} from '@mui/material'; } from '@mui/material';
// layouts // layouts
import MainLayout from '../layouts/main'; import MainLayout from '../layouts/main';
...@@ -43,6 +44,8 @@ import Iconify from 'src/components/iconify/Iconify'; ...@@ -43,6 +44,8 @@ import Iconify from 'src/components/iconify/Iconify';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import SignLanguageToTextService from 'src/services/SignLanguageToText.js'; import SignLanguageToTextService from 'src/services/SignLanguageToText.js';
import { Block } from 'src/sections/_examples/Block';
const useReactMediaRecorder = () => const useReactMediaRecorder = () =>
// eslint-disable-next-line react-hooks/rules-of-hooks // eslint-disable-next-line react-hooks/rules-of-hooks
import('react-media-recorder'); import('react-media-recorder');
...@@ -59,6 +62,7 @@ export default function AboutPage() { ...@@ -59,6 +62,7 @@ export default function AboutPage() {
const [videoUrl, setVideoUrl] = useState(''); const [videoUrl, setVideoUrl] = useState('');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [value, setValue] = useState(''); const [value, setValue] = useState('');
const [speed, setSpeed] = useState(0);
const handleDropSingleFile = useCallback(async (acceptedFiles: File[]) => { const handleDropSingleFile = useCallback(async (acceptedFiles: File[]) => {
const file = acceptedFiles[0]; const file = acceptedFiles[0];
...@@ -113,7 +117,7 @@ export default function AboutPage() { ...@@ -113,7 +117,7 @@ export default function AboutPage() {
formData.append('video_request', file, 'test_video.mp4'); formData.append('video_request', file, 'test_video.mp4');
try { try {
const response = await SignLanguageToTextService.predictSignLanguageVideo(10, formData); const response = await SignLanguageToTextService.predictSignLanguageVideo(speed, formData);
if (response.status == 200) { if (response.status == 200) {
console.log(response.data); console.log(response.data);
setValue(response.data.predictions); setValue(response.data.predictions);
...@@ -131,6 +135,11 @@ export default function AboutPage() { ...@@ -131,6 +135,11 @@ export default function AboutPage() {
} }
}; };
function valuetext(value: number) {
setSpeed(value);
return `$${value}°C`;
}
return ( return (
<> <>
<Head> <Head>
...@@ -190,28 +199,44 @@ export default function AboutPage() { ...@@ -190,28 +199,44 @@ export default function AboutPage() {
<Card sx={{ p: 5, minHeight: 300 }}> <Card sx={{ p: 5, minHeight: 300 }}>
<Box display="grid" gap={5}> <Box display="grid" gap={5}>
<Stack spacing={2}> <Stack spacing={2}>
<Grid <Grid container spacing={2}>
item <Grid item xs={12} md={6}>
xs={12} <h3>Set Sign Speed </h3>
md={12}
container <Slider
direction="row" defaultValue={30}
justifyContent="flex-end" getAriaValueText={valuetext}
alignItems="center" valueLabelDisplay="auto"
> step={10}
<Button marks
variant="contained" min={10}
style={{ width: '200px', height: '60px', fontSize: '20px' }} max={110}
sx={{ />
mb: 3, <h4>Speed - {speed}</h4>
}} </Grid>
disabled={loading} <Grid
onClick={() => { item
translateSignLanguageToText(); xs={12}
}} md={6}
container
direction="row"
justifyContent="flex-end"
alignItems="center"
> >
Translate <Button
</Button> variant="contained"
style={{ width: '200px', height: '60px', fontSize: '20px' }}
sx={{
mb: 3,
}}
disabled={loading}
onClick={() => {
translateSignLanguageToText();
}}
>
Translate
</Button>
</Grid>
</Grid> </Grid>
{loading ? ( {loading ? (
<Card> <Card>
...@@ -273,28 +298,44 @@ export default function AboutPage() { ...@@ -273,28 +298,44 @@ export default function AboutPage() {
<Card sx={{ p: 5, minHeight: 300 }}> <Card sx={{ p: 5, minHeight: 300 }}>
<Box display="grid" gap={5}> <Box display="grid" gap={5}>
<Stack spacing={2}> <Stack spacing={2}>
<Grid <Grid container spacing={2}>
item <Grid item xs={12} md={6}>
xs={12} <h3>Set Sign Speed </h3>
md={12}
container <Slider
direction="row" defaultValue={30}
justifyContent="flex-end" getAriaValueText={valuetext}
alignItems="center" valueLabelDisplay="auto"
> step={10}
<Button marks
variant="contained" min={10}
style={{ width: '200px', height: '60px', fontSize: '20px' }} max={110}
sx={{ />
mb: 3, <h4>Speed - {speed}</h4>
}} </Grid>
disabled={loading} <Grid
onClick={() => { item
translateSignLanguageToText(); xs={12}
}} md={6}
container
direction="row"
justifyContent="flex-end"
alignItems="center"
> >
Translate <Button
</Button> variant="contained"
style={{ width: '200px', height: '60px', fontSize: '20px' }}
sx={{
mb: 3,
}}
disabled={loading}
onClick={() => {
translateSignLanguageToText();
}}
>
Translate
</Button>
</Grid>
</Grid> </Grid>
{loading ? ( {loading ? (
<Card> <Card>
......
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