client change
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { Snackbar, Alert, Button } from "@mui/material";
|
import { Snackbar, Alert } from "@mui/material";
|
||||||
import {
|
import {
|
||||||
Typography,
|
Typography,
|
||||||
Container,
|
Container,
|
||||||
@@ -41,6 +41,7 @@ function ProcessingPage() {
|
|||||||
console.log("response from server:", res);
|
console.log("response from server:", res);
|
||||||
if (res.status === 200 && res.data) {
|
if (res.status === 200 && res.data) {
|
||||||
showToast(res.data.message, "success");
|
showToast(res.data.message, "success");
|
||||||
|
setProgress(25)
|
||||||
processTrim();
|
processTrim();
|
||||||
} else {
|
} else {
|
||||||
showToast("Audio Normalization failed", "error");
|
showToast("Audio Normalization failed", "error");
|
||||||
@@ -66,8 +67,10 @@ function ProcessingPage() {
|
|||||||
if (res.status === 200 && res.data) {
|
if (res.status === 200 && res.data) {
|
||||||
showToast(res.data.message, "success");
|
showToast(res.data.message, "success");
|
||||||
if (response.audio_class === "Music") {
|
if (response.audio_class === "Music") {
|
||||||
|
setProgress(50)
|
||||||
processResampling();
|
processResampling();
|
||||||
}else{
|
}else{
|
||||||
|
setProgress(75)
|
||||||
processNoiseReduce()
|
processNoiseReduce()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -95,6 +98,7 @@ function ProcessingPage() {
|
|||||||
console.log("response from server:", res);
|
console.log("response from server:", res);
|
||||||
if (res.status === 200 && res.data) {
|
if (res.status === 200 && res.data) {
|
||||||
showToast(res.data.message, "success");
|
showToast(res.data.message, "success");
|
||||||
|
setProgress(75)
|
||||||
processSeparate()
|
processSeparate()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -121,6 +125,9 @@ function ProcessingPage() {
|
|||||||
console.log("response from server:", res);
|
console.log("response from server:", res);
|
||||||
if (res.status === 200 && res.data) {
|
if (res.status === 200 && res.data) {
|
||||||
showToast(res.data.message, "success");
|
showToast(res.data.message, "success");
|
||||||
|
setTimeout(()=>{
|
||||||
|
setProgress(100)
|
||||||
|
},5000)
|
||||||
} else {
|
} else {
|
||||||
showToast("Audio NoiseRemoval failed", "error");
|
showToast("Audio NoiseRemoval failed", "error");
|
||||||
}
|
}
|
||||||
@@ -143,6 +150,7 @@ function ProcessingPage() {
|
|||||||
);
|
);
|
||||||
console.log("response from server:", res);
|
console.log("response from server:", res);
|
||||||
if (res.status === 200 && res.data) {
|
if (res.status === 200 && res.data) {
|
||||||
|
setProgress(100)
|
||||||
showToast("Audio separated successfully", "success");
|
showToast("Audio separated successfully", "success");
|
||||||
} else {
|
} else {
|
||||||
showToast("Audio separation failed", "error");
|
showToast("Audio separation failed", "error");
|
||||||
@@ -162,24 +170,14 @@ function ProcessingPage() {
|
|||||||
console.log("Normalizing....");
|
console.log("Normalizing....");
|
||||||
processNormalize();
|
processNormalize();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Simulate processing progress
|
|
||||||
const interval = setInterval(() => {
|
|
||||||
setProgress((prevProgress) => {
|
|
||||||
const newProgress = prevProgress + 10;
|
|
||||||
if (newProgress >= 100) {
|
|
||||||
clearInterval(interval);
|
|
||||||
setTimeout(() => navigate("/results"), 500);
|
|
||||||
return 100;
|
|
||||||
}
|
|
||||||
return newProgress;
|
|
||||||
});
|
|
||||||
}, 800);
|
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
|
||||||
}, [mediaFile, navigate]);
|
}, [mediaFile, navigate]);
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
if(progress == 100){
|
||||||
|
navigate('/results')
|
||||||
|
}
|
||||||
|
},[progress])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container maxWidth="md" sx={{ py: 4 }}>
|
<Container maxWidth="md" sx={{ py: 4 }}>
|
||||||
<StepperComponent activeStep={2} />
|
<StepperComponent activeStep={2} />
|
||||||
|
|||||||
Reference in New Issue
Block a user