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,10 +199,25 @@ export default function AboutPage() { ...@@ -190,10 +199,25 @@ 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 container spacing={2}>
<Grid item xs={12} md={6}>
<h3>Set Sign Speed </h3>
<Slider
defaultValue={30}
getAriaValueText={valuetext}
valueLabelDisplay="auto"
step={10}
marks
min={10}
max={110}
/>
<h4>Speed - {speed}</h4>
</Grid>
<Grid <Grid
item item
xs={12} xs={12}
md={12} md={6}
container container
direction="row" direction="row"
justifyContent="flex-end" justifyContent="flex-end"
...@@ -213,6 +237,7 @@ export default function AboutPage() { ...@@ -213,6 +237,7 @@ export default function AboutPage() {
Translate Translate
</Button> </Button>
</Grid> </Grid>
</Grid>
{loading ? ( {loading ? (
<Card> <Card>
<CardContent> <CardContent>
...@@ -273,10 +298,25 @@ export default function AboutPage() { ...@@ -273,10 +298,25 @@ 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 container spacing={2}>
<Grid item xs={12} md={6}>
<h3>Set Sign Speed </h3>
<Slider
defaultValue={30}
getAriaValueText={valuetext}
valueLabelDisplay="auto"
step={10}
marks
min={10}
max={110}
/>
<h4>Speed - {speed}</h4>
</Grid>
<Grid <Grid
item item
xs={12} xs={12}
md={12} md={6}
container container
direction="row" direction="row"
justifyContent="flex-end" justifyContent="flex-end"
...@@ -296,6 +336,7 @@ export default function AboutPage() { ...@@ -296,6 +336,7 @@ export default function AboutPage() {
Translate Translate
</Button> </Button>
</Grid> </Grid>
</Grid>
{loading ? ( {loading ? (
<Card> <Card>
<CardContent> <CardContent>
......
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