Yann commited on
Commit
d909077
·
1 Parent(s): f4c2b73

push syntax update + dotenv integration + compiler options + loading screen

Browse files
back/generators/vst_generator.py CHANGED
@@ -122,14 +122,14 @@ class VSTGenerator(SoundGenerator):
122
  fixed = []
123
  for line in self.synth.get_parameters_description():
124
  line['defaultValue']=float(line['defaultValue'])
125
- if line['index'] < 86:
126
  # fixed.append(
127
  # {"id": line['index'], "name": line['name'], "value": line['defaultValue']}
128
  # )
129
  # else:
130
- params.append(
131
- {"id": line['index'], "name": line['name'], "value": line['defaultValue']}
132
- )
133
  output = {"parameters": params, "fixed_parameters": fixed}
134
  os.makedirs("plugin_config", exist_ok=True)
135
  with open("plugin_config/gen_config_"+str(self.vst)+'.json', "w") as f:
 
122
  fixed = []
123
  for line in self.synth.get_parameters_description():
124
  line['defaultValue']=float(line['defaultValue'])
125
+ # if line['index'] < 86:
126
  # fixed.append(
127
  # {"id": line['index'], "name": line['name'], "value": line['defaultValue']}
128
  # )
129
  # else:
130
+ params.append(
131
+ {"id": line['index'], "name": line['name'], "value": line['defaultValue']}
132
+ )
133
  output = {"parameters": params, "fixed_parameters": fixed}
134
  os.makedirs("plugin_config", exist_ok=True)
135
  with open("plugin_config/gen_config_"+str(self.vst)+'.json', "w") as f:
back/main.py CHANGED
@@ -1,5 +1,6 @@
1
  from contextlib import asynccontextmanager
2
  import uuid
 
3
  from fastapi import Depends, FastAPI, File, HTTPException, UploadFile
4
  from fastapi.responses import JSONResponse
5
  from fastapi.staticfiles import StaticFiles
@@ -9,14 +10,16 @@ from fastapi.middleware.cors import CORSMiddleware
9
  import pathlib
10
  from contextlib import asynccontextmanager
11
  from glob import glob
 
12
 
13
-
14
- from models.launch import inferrence, train_model
15
  from models.spectrogram_cnn import get_model
16
 
17
  # distinguish model type for reshaping
18
 
19
- SERVER = "https://yderre-aubay-infer-vst.hf.space/"
 
 
20
 
21
  path = os.path.dirname(os.path.realpath(__file__))
22
 
@@ -46,9 +49,6 @@ def load_model_and_parameters():
46
 
47
  @asynccontextmanager
48
  async def lifespan(app: FastAPI):
49
-
50
-
51
-
52
  # Remove all files in the temp folder
53
  tempFolderPath = os.path.join(path, "temp")
54
  if os.path.exists(tempFolderPath):
@@ -80,10 +80,6 @@ class SPAStaticFiles(StaticFiles):
80
  else:
81
  raise ex
82
 
83
-
84
-
85
-
86
-
87
  @app.get("/download/{file_id}")
88
  async def generate_audio(file_id: str):
89
  try:
@@ -141,6 +137,7 @@ async def upload_audio_file(file: UploadFile = File(...)):
141
  # generate_output_audio(file_path, output_file_path)
142
  output = await start_inference(model=model, parameters_file=parameters_file, file_id=file_id, file_extension=file_extension)
143
  # Send a confirmation with the identifier
 
144
  return {"file_path": SERVER+output[0], "csv_path": SERVER+output[1], "output_file_path": SERVER+output[2]}
145
 
146
  except Exception as e:
@@ -149,7 +146,7 @@ async def upload_audio_file(file: UploadFile = File(...)):
149
  async def start_inference(model, parameters_file, file_id: str, file_extension : str):
150
  file_path = os.path.join("temp", file_id + file_extension)
151
 
152
- output = inferrence(model=model, parameters_file=parameters_file, file_path=file_path, file_id=file_id)
153
 
154
  return output
155
 
 
1
  from contextlib import asynccontextmanager
2
  import uuid
3
+ from dotenv import load_dotenv
4
  from fastapi import Depends, FastAPI, File, HTTPException, UploadFile
5
  from fastapi.responses import JSONResponse
6
  from fastapi.staticfiles import StaticFiles
 
10
  import pathlib
11
  from contextlib import asynccontextmanager
12
  from glob import glob
13
+ import os
14
 
15
+ from models.launch import inference, train_model
 
16
  from models.spectrogram_cnn import get_model
17
 
18
  # distinguish model type for reshaping
19
 
20
+ load_dotenv()
21
+
22
+ SERVER = str(os.environ.get('API_URL'))
23
 
24
  path = os.path.dirname(os.path.realpath(__file__))
25
 
 
49
 
50
  @asynccontextmanager
51
  async def lifespan(app: FastAPI):
 
 
 
52
  # Remove all files in the temp folder
53
  tempFolderPath = os.path.join(path, "temp")
54
  if os.path.exists(tempFolderPath):
 
80
  else:
81
  raise ex
82
 
 
 
 
 
83
  @app.get("/download/{file_id}")
84
  async def generate_audio(file_id: str):
85
  try:
 
137
  # generate_output_audio(file_path, output_file_path)
138
  output = await start_inference(model=model, parameters_file=parameters_file, file_id=file_id, file_extension=file_extension)
139
  # Send a confirmation with the identifier
140
+ print(SERVER+output[0])
141
  return {"file_path": SERVER+output[0], "csv_path": SERVER+output[1], "output_file_path": SERVER+output[2]}
142
 
143
  except Exception as e:
 
146
  async def start_inference(model, parameters_file, file_id: str, file_extension : str):
147
  file_path = os.path.join("temp", file_id + file_extension)
148
 
149
+ output = inference(model=model, parameters_file=parameters_file, file_path=file_path, file_id=file_id)
150
 
151
  return output
152
 
back/models/launch.py CHANGED
@@ -301,7 +301,9 @@ PRINT = 1
301
  # DAWDREAMER EXPORT SETTINGS
302
  SAMPLE_RATE = 16384
303
  BUFFER_SIZE = 1024
304
- SYNTH_PLUGIN = "libTAL-NoiseMaker.so"
 
 
305
 
306
  ENGINE = daw.RenderEngine(SAMPLE_RATE, BUFFER_SIZE)
307
  SYNTH = ENGINE.make_plugin_processor("my_synth", SYNTH_PLUGIN)
@@ -405,7 +407,7 @@ def train_model(
405
  return model, parameters_file
406
 
407
 
408
- def inferrence(model: keras.Model, parameters_file: str, file_path: str, file_id: str):
409
  # Start infer
410
 
411
  with open(parameters_file, "rb") as f:
 
301
  # DAWDREAMER EXPORT SETTINGS
302
  SAMPLE_RATE = 16384
303
  BUFFER_SIZE = 1024
304
+ SYNTH_PLUGIN = 'libTAL-NoiseMaker.so'
305
+
306
+ # SYNTH_PLUGIN = "TAL-NoiseMaker.vst3"
307
 
308
  ENGINE = daw.RenderEngine(SAMPLE_RATE, BUFFER_SIZE)
309
  SYNTH = ENGINE.make_plugin_processor("my_synth", SYNTH_PLUGIN)
 
407
  return model, parameters_file
408
 
409
 
410
+ def inference(model: keras.Model, parameters_file: str, file_path: str, file_id: str):
411
  # Start infer
412
 
413
  with open(parameters_file, "rb") as f:
back/models/spectrogram_cnn.py CHANGED
@@ -112,7 +112,7 @@ def get_model(
112
 
113
  if __name__ == "__main__":
114
 
115
- from models.launch import train_model, inferrence
116
  from models.runner import standard_run_parser
117
 
118
  # Get a standard parser, and the arguments out of it
@@ -127,7 +127,7 @@ if __name__ == "__main__":
127
 
128
  model, parameters_file = train_model(model_callback=get_model, **setup)
129
 
130
- file_path, csv_path = inferrence(model, parameters_file)
131
 
132
  print(file_path)
133
 
 
112
 
113
  if __name__ == "__main__":
114
 
115
+ from models.launch import train_model, inference
116
  from models.runner import standard_run_parser
117
 
118
  # Get a standard parser, and the arguments out of it
 
127
 
128
  model, parameters_file = train_model(model_callback=get_model, **setup)
129
 
130
+ file_path, csv_path = inference(model, parameters_file)
131
 
132
  print(file_path)
133
 
back/requirements.txt CHANGED
@@ -26,3 +26,4 @@ keras-preprocessing
26
  keras
27
  librosa
28
  h5py
 
 
26
  keras
27
  librosa
28
  h5py
29
+ dotenv
front/.env ADDED
@@ -0,0 +1 @@
 
 
1
+ VITE_API_URL = http://localhost:7860
front/dist/assets/index-GjkfYCwO.js DELETED
The diff for this file is too large to render. See raw diff
 
front/src/components/AppBar/MainAppBar.tsx CHANGED
@@ -12,12 +12,13 @@ import {
12
  useTheme
13
  } from "@mui/material";
14
  import { FC, useContext, useState } from "react";
15
- import { useLocation, useNavigate } from "react-router-dom";
16
  import { ThemeModeContext, ThemeSchemeContext } from "../../theme";
17
 
18
  import DarkIcon from "@mui/icons-material/DarkModeOutlined";
19
  import LightIcon from "@mui/icons-material/LightModeOutlined";
20
  import MenuIcon from "@mui/icons-material/MenuTwoTone";
 
21
 
22
  interface HeaderProps {
23
  onDrawerToggle?: () => void;
@@ -26,19 +27,8 @@ interface HeaderProps {
26
 
27
  const MainAppBar: FC<HeaderProps> = ({ onDrawerToggle, window }) => {
28
  const { toggleTheme, themeMode, setThemeMode } = useContext(ThemeModeContext);
29
- const { generateScheme, themeScheme } = useContext(ThemeSchemeContext);
30
 
31
- const muiTheme = useTheme();
32
  const location = useLocation();
33
- const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
34
- const open = Boolean(anchorEl);
35
-
36
- const openMenu = (event: React.MouseEvent<HTMLButtonElement>) => {
37
- setAnchorEl(event.currentTarget);
38
- };
39
- const closeMenu = () => {
40
- setAnchorEl(null);
41
- };
42
 
43
  const [openModal, setOpenModal] = useState(false)
44
  const handleOpen = () => setOpenModal(true)
@@ -50,67 +40,28 @@ const MainAppBar: FC<HeaderProps> = ({ onDrawerToggle, window }) => {
50
  target: window ? window() : undefined,
51
  });
52
 
53
- const DIGITS: string = "0123456789ABCDEF";
54
-
55
- const randomColor = (): string => {
56
- let result = "";
57
- for (let i = 0; i < 6; ++i) {
58
- const index = Math.floor(16 * Math.random());
59
- result += DIGITS[index];
60
- }
61
- return "#" + result;
62
- };
63
-
64
- const onGenerate = () => generateScheme(randomColor());
65
-
66
- const onReset = () => {
67
- generateScheme("#6750a4"); //#6750a4 #005fb0
68
- setThemeMode("light");
69
- };
70
-
71
- const downloadTheme = () => {
72
- closeMenu();
73
-
74
- const themeString = JSON.stringify(themeScheme, null, 2);
75
- // make it downloadable
76
- const element = document.createElement("a");
77
- const file = new Blob([themeString], { type: "application/json" });
78
- element.href = URL.createObjectURL(file);
79
- element.download = "ThemeScheme.json";
80
- document.body.appendChild(element);
81
- element.click();
82
- };
83
 
84
- const downloadMUITheme = () => {
85
- closeMenu();
86
-
87
- const themeString = JSON.stringify(muiTheme, null, 2);
88
- // make it downloadable
89
- const element = document.createElement("a");
90
- const file = new Blob([themeString], { type: "application/json" });
91
- element.href = URL.createObjectURL(file);
92
- element.download = "ThemeMUI.json";
93
- document.body.appendChild(element);
94
- element.click();
95
- };
96
-
97
- const navigate = useNavigate();
98
  return (
99
  <>
100
  <AppBar position="sticky" elevation={trigger ? 2 : 0}>
101
  <Toolbar>
102
  <Grid container spacing={1} alignItems="center">
103
- <Grid item sx={{ display: { md: "none", sm: "block" } }}>
104
- <IconButton color="inherit" edge="start" onClick={onDrawerToggle}>
105
- <MenuIcon />
106
- </IconButton>
 
 
 
 
107
  </Grid>
108
  <Grid item sx={{ display: "flex", alignItems: "baseline" }}>
109
  <Typography
110
  color="inherit"
111
- sx={{ fontWeight: 500, letterSpacing: 0.5, fontSize: 20 }}
112
  >
113
- {location.pathname.replace("/", "")}
114
  </Typography>
115
  </Grid>
116
  <Grid item xs></Grid>
@@ -123,7 +74,7 @@ const MainAppBar: FC<HeaderProps> = ({ onDrawerToggle, window }) => {
123
  </Grid>
124
  </Grid>
125
  <Button variant="tonal" color="tertiary" onClick={handleOpen}>
126
- Credits
127
  </Button>
128
  <div>
129
  <Modal
@@ -142,7 +93,7 @@ const MainAppBar: FC<HeaderProps> = ({ onDrawerToggle, window }) => {
142
  fontStyle: "italic",
143
  }}
144
  >
145
- Inferrence
146
  </Typography>
147
 
148
  <Typography
@@ -231,7 +182,7 @@ const style_modal = {
231
  top: "50%",
232
  left: "50%",
233
  transform: "translate(-50%, -50%)",
234
- width: 500,
235
  color: "inherit",
236
  bgcolor: "background.paper",
237
  p: 4,
 
12
  useTheme
13
  } from "@mui/material";
14
  import { FC, useContext, useState } from "react";
15
+ import { Navigate, useLocation, useNavigate, useNavigation } from "react-router-dom";
16
  import { ThemeModeContext, ThemeSchemeContext } from "../../theme";
17
 
18
  import DarkIcon from "@mui/icons-material/DarkModeOutlined";
19
  import LightIcon from "@mui/icons-material/LightModeOutlined";
20
  import MenuIcon from "@mui/icons-material/MenuTwoTone";
21
+ import { Home } from "@mui/icons-material";
22
 
23
  interface HeaderProps {
24
  onDrawerToggle?: () => void;
 
27
 
28
  const MainAppBar: FC<HeaderProps> = ({ onDrawerToggle, window }) => {
29
  const { toggleTheme, themeMode, setThemeMode } = useContext(ThemeModeContext);
 
30
 
 
31
  const location = useLocation();
 
 
 
 
 
 
 
 
 
32
 
33
  const [openModal, setOpenModal] = useState(false)
34
  const handleOpen = () => setOpenModal(true)
 
40
  target: window ? window() : undefined,
41
  });
42
 
43
+ const navigate = useNavigate()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  return (
46
  <>
47
  <AppBar position="sticky" elevation={trigger ? 2 : 0}>
48
  <Toolbar>
49
  <Grid container spacing={1} alignItems="center">
50
+ <Grid item sx={{ display: "flex", alignItems: "center", alignContent:"center"}} onClick={(e) => navigate('/Home')}>
51
+ <Home sx={{pr: 1.5, fontSize:30}}/>
52
+ <Typography
53
+ color="inherit"
54
+ sx={{ fontWeight: "bold", letterSpacing: 1, fontSize: 20, fontFamily:"monospace" }}
55
+ >
56
+ AMP Aubay
57
+ </Typography>
58
  </Grid>
59
  <Grid item sx={{ display: "flex", alignItems: "baseline" }}>
60
  <Typography
61
  color="inherit"
62
+ sx={{ fontWeight: "normal", letterSpacing: 0.5, fontSize: 20, fontFamily:"monospace", pl:1}}
63
  >
64
+ // {location.pathname.replace("/", "")}
65
  </Typography>
66
  </Grid>
67
  <Grid item xs></Grid>
 
74
  </Grid>
75
  </Grid>
76
  <Button variant="tonal" color="tertiary" onClick={handleOpen}>
77
+ About
78
  </Button>
79
  <div>
80
  <Modal
 
93
  fontStyle: "italic",
94
  }}
95
  >
96
+ Inference
97
  </Typography>
98
 
99
  <Typography
 
182
  top: "50%",
183
  left: "50%",
184
  transform: "translate(-50%, -50%)",
185
+ width: "auto",
186
  color: "inherit",
187
  bgcolor: "background.paper",
188
  p: 4,
front/src/components/Drawer/MainDrawer.tsx CHANGED
@@ -1,5 +1,5 @@
1
  import { Box, Drawer, DrawerProps, Fab, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Toolbar, Typography } from "@mui/material";
2
- import { FC, useState, useEffect } from 'react';
3
 
4
  import { Link, useLocation } from "react-router-dom";
5
 
@@ -8,15 +8,10 @@ import HomeIconOutlined from '@mui/icons-material/HomeOutlined';
8
  import InfoIcon from '@mui/icons-material/Info';
9
  import InfoIconOutlined from '@mui/icons-material/InfoOutlined';
10
 
11
- import PeopleIcon from '@mui/icons-material/PeopleOutline';
12
- import PermMediaOutlinedIcon from '@mui/icons-material/PhotoSizeSelectActualOutlined';
13
- import PublicIcon from '@mui/icons-material/PublicOutlined';
14
- import SettingsEthernetIcon from '@mui/icons-material/SettingsEthernetOutlined';
15
- import SettingsInputComponentIcon from '@mui/icons-material/SettingsInputComponentOutlined';
16
- import PaletteOutlinedIcon from '@mui/icons-material/PaletteOutlined';
17
- import PaletteTwoToneIcon from '@mui/icons-material/Palette';
18
  import Add from "@mui/icons-material/Add";
19
- import { AddOutlined, FlashOn, FlashOnOutlined } from "@mui/icons-material";
 
20
 
21
  const MainDrawer: FC<DrawerProps> = (props) => {
22
  const { onClose, ...others } = props;
@@ -54,19 +49,14 @@ const MainDrawer: FC<DrawerProps> = (props) => {
54
  onClose?.({}, 'backdropClick');
55
  };
56
  return (
57
- <Drawer {...others} onClose={onClose}>
58
- <Toolbar >
59
- <Typography color="inherit" sx={{ fontWeight: "bold", letterSpacing: 0.5, fontSize: 25, py:2, pt:5, textAlign: "center"}}>
60
- Placeholder logo
61
- </Typography>
62
- </Toolbar>
63
  <Box sx={{py:1}}/>
64
- <Fab color='tertiary' sx={{mx: 2, px: 1, py:1, height: "50px"}} variant='extended' component={Link} to='/Inferrence' onClick={() => handleListItemClick('Inferrence')}>
65
- {selectedIndex == 'Inferrence' ? <Add sx={{ mr: 1 }} /> : <AddOutlined sx={{ mr: 1 }} />}
66
- <Typography color="inherit" sx={{ mr: 1, fontSize: 16, fontWeight: 500, mt:0.3}}>New inferrence</Typography>
67
  </Fab>
68
  <Box sx={{py:1}}/>
69
- <List>
70
  <Box>
71
  <ListItem >
72
  <ListItemButton component={Link} to='/Home' selected={selectedIndex == 'Home'} onClick={() => handleListItemClick('Home')}>
@@ -77,11 +67,11 @@ const MainDrawer: FC<DrawerProps> = (props) => {
77
  </ListItemButton>
78
  </ListItem>
79
  <ListItem >
80
- <ListItemButton component={Link} to='/Inferrence' selected={selectedIndex == 'Inferrence'} onClick={() => handleListItemClick('Inferrence')}>
81
  <ListItemIcon>
82
- {selectedIndex == 'Inferrence' ? <PaletteTwoToneIcon /> : <PaletteOutlinedIcon />}
83
  </ListItemIcon>
84
- <ListItemText>Inferrence</ListItemText>
85
  </ListItemButton>
86
  </ListItem>
87
  <ListItem >
@@ -93,27 +83,8 @@ const MainDrawer: FC<DrawerProps> = (props) => {
93
  </ListItemButton>
94
  </ListItem>
95
  </Box>
96
- {/* {categories.map(({ id, children }) => (
97
- <Box key={id}>
98
- <ListItem sx={{ py: 2, px: 3 }}>
99
- <ListItemText sx={{ fontWeight: 'bold' }}>
100
- <Typography color="inherit" sx={{ ml: 1, fontSize: 15, fontWeight: 500 }} >
101
- {id}
102
- </Typography>
103
- </ListItemText>
104
- </ListItem>
105
- {children.map(({ id: childId, icon }) => (
106
- <ListItem key={childId}>
107
- <ListItemButton selected={selectedIndex == childId} onClick={() => handleListItemClick(childId)}>
108
- <ListItemIcon>{icon}</ListItemIcon>
109
- <ListItemText>{childId}</ListItemText>
110
- </ListItemButton>
111
- </ListItem>
112
- ))}
113
- </Box>
114
- ))} */}
115
- </List>
116
- </Drawer>
117
  );
118
  };
119
 
 
1
  import { Box, Drawer, DrawerProps, Fab, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Toolbar, Typography } from "@mui/material";
2
+ import { FC, useEffect, useState } from 'react';
3
 
4
  import { Link, useLocation } from "react-router-dom";
5
 
 
8
  import InfoIcon from '@mui/icons-material/Info';
9
  import InfoIconOutlined from '@mui/icons-material/InfoOutlined';
10
 
11
+ import { AddOutlined } from "@mui/icons-material";
 
 
 
 
 
 
12
  import Add from "@mui/icons-material/Add";
13
+ import PaletteTwoToneIcon from '@mui/icons-material/Palette';
14
+ import PaletteOutlinedIcon from '@mui/icons-material/PaletteOutlined';
15
 
16
  const MainDrawer: FC<DrawerProps> = (props) => {
17
  const { onClose, ...others } = props;
 
49
  onClose?.({}, 'backdropClick');
50
  };
51
  return (
52
+ <>
 
 
 
 
 
53
  <Box sx={{py:1}}/>
54
+ <Fab color='tertiary' sx={{mx: 2, px: 1, py:1, height: "50px"}} variant='extended' component={Link} to='/Inference' onClick={() => handleListItemClick('Inference')}>
55
+ {selectedIndex == 'Inference' ? <Add sx={{ mr: 1 }} /> : <AddOutlined sx={{ mr: 1 }} />}
56
+ <Typography color="inherit" sx={{ mr: 1, fontSize: 16, fontWeight: 500, mt:0.3}}>New inference</Typography>
57
  </Fab>
58
  <Box sx={{py:1}}/>
59
+ {/* <List>
60
  <Box>
61
  <ListItem >
62
  <ListItemButton component={Link} to='/Home' selected={selectedIndex == 'Home'} onClick={() => handleListItemClick('Home')}>
 
67
  </ListItemButton>
68
  </ListItem>
69
  <ListItem >
70
+ <ListItemButton component={Link} to='/Inference' selected={selectedIndex == 'Inference'} onClick={() => handleListItemClick('Inference')}>
71
  <ListItemIcon>
72
+ {selectedIndex == 'Inference' ? <PaletteTwoToneIcon /> : <PaletteOutlinedIcon />}
73
  </ListItemIcon>
74
+ <ListItemText>Inference</ListItemText>
75
  </ListItemButton>
76
  </ListItem>
77
  <ListItem >
 
83
  </ListItemButton>
84
  </ListItem>
85
  </Box>
86
+ </List> */}
87
+ </>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  );
89
  };
90
 
front/src/pages/Express/Express.tsx CHANGED
@@ -19,7 +19,7 @@ const Express = () => {
19
  }}
20
  >
21
  <Stack sx={{ height: '30vh', borderRadius: '12px', gap: "30px", minWidth: "20vw", maxWidth:"300px"}}>
22
- <Card variant="outlined" onClick={() => navigate("/Inferrence")}>
23
  <Box>
24
  <CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", userSelect: "none", gap:"30px"}}>
25
  <Box sx={{ display: "flex", flexDirection:"column" }}>
 
19
  }}
20
  >
21
  <Stack sx={{ height: '30vh', borderRadius: '12px', gap: "30px", minWidth: "20vw", maxWidth:"300px"}}>
22
+ <Card variant="outlined" onClick={() => navigate("/Inference")}>
23
  <Box>
24
  <CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", userSelect: "none", gap:"30px"}}>
25
  <Box sx={{ display: "flex", flexDirection:"column" }}>
front/src/pages/Home/Home.tsx CHANGED
@@ -1,15 +1,29 @@
1
 
2
- import { Stack } from '@mui/material';
3
 
4
  import MainContainer from '../../components/Container/MainContainer';
5
 
6
  import { FlashOn, Settings } from "@mui/icons-material";
7
  import { Box, Card, CardContent, Divider, Typography } from "@mui/material";
8
  import { useNavigate } from "react-router-dom";
 
9
 
10
  const Home = () => {
11
  const navigate = useNavigate()
 
12
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  return (
14
  <>
15
  <MainContainer>
@@ -18,13 +32,12 @@ const Home = () => {
18
  sx={{
19
  justifyContent: "center",
20
  display: "flex",
21
- pt: 10,
22
- height:"100%",
23
  alignItems: "center",
24
  }}
25
  >
26
  <Stack sx={{ height: '100%', borderRadius: '12px', gap: "30px", minWidth: "20vw", maxWidth:"300px"}}>
27
- <Card variant="outlined" onClick={() => navigate("/Inferrence")}>
28
  <Box>
29
  <CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", userSelect: "none", gap:"30px"}}>
30
  <Box sx={{ display: "flex", flexDirection:"column" }}>
@@ -37,7 +50,7 @@ const Home = () => {
37
  </Card>
38
  <Box></Box>
39
  <Divider>Or</Divider>
40
- <Card variant="outlined" onClick={() => navigate("/CustomizeVST")}>
41
  <Box sx={{ display: "inherit"}}>
42
  <CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", gap:"30px", userSelect: "none"}}>
43
  <Box sx={{ display: "flex", flexDirection:"column" }}>
@@ -49,6 +62,14 @@ const Home = () => {
49
  </Box>
50
  </Card>
51
  </Stack>
 
 
 
 
 
 
 
 
52
  </Box>
53
  </MainContainer>
54
  </>
@@ -78,7 +99,7 @@ export function ExplainText(props: any) {
78
  <Typography variant="h4">Hi!👋</Typography>
79
  <div style={{ paddingTop: "10px" }}>
80
  <Typography fontSize={"20px"}>
81
- Start inferring now!!!!!! 🧑‍🍳🧑‍🍳
82
  </Typography>
83
  </div>
84
  </Box>
 
1
 
2
+ import { Snackbar, Stack } from '@mui/material';
3
 
4
  import MainContainer from '../../components/Container/MainContainer';
5
 
6
  import { FlashOn, Settings } from "@mui/icons-material";
7
  import { Box, Card, CardContent, Divider, Typography } from "@mui/material";
8
  import { useNavigate } from "react-router-dom";
9
+ import { useState } from 'react';
10
 
11
  const Home = () => {
12
  const navigate = useNavigate()
13
+ const [open, setOpen] = useState(false);
14
 
15
+ const handleClick = () => {
16
+ setOpen(true);
17
+ };
18
+
19
+ const handleClose = (event: React.SyntheticEvent | Event, reason?: string) => {
20
+ if (reason === 'clickaway') {
21
+ return;
22
+ }
23
+
24
+ setOpen(false);
25
+ };
26
+
27
  return (
28
  <>
29
  <MainContainer>
 
32
  sx={{
33
  justifyContent: "center",
34
  display: "flex",
35
+ pt: 2,
 
36
  alignItems: "center",
37
  }}
38
  >
39
  <Stack sx={{ height: '100%', borderRadius: '12px', gap: "30px", minWidth: "20vw", maxWidth:"300px"}}>
40
+ <Card variant="outlined" onClick={() => navigate("/Inference")}>
41
  <Box>
42
  <CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", userSelect: "none", gap:"30px"}}>
43
  <Box sx={{ display: "flex", flexDirection:"column" }}>
 
50
  </Card>
51
  <Box></Box>
52
  <Divider>Or</Divider>
53
+ <Card variant="outlined" onClick={() => handleClick()}>
54
  <Box sx={{ display: "inherit"}}>
55
  <CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", gap:"30px", userSelect: "none"}}>
56
  <Box sx={{ display: "flex", flexDirection:"column" }}>
 
62
  </Box>
63
  </Card>
64
  </Stack>
65
+ <Snackbar
66
+ anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
67
+ open={open}
68
+ onClose={handleClose}
69
+ message="This feature is not yet available :("
70
+ sx={{borderRadius:"200px"}}
71
+ style={{borderRadius:"200px"}}
72
+ />
73
  </Box>
74
  </MainContainer>
75
  </>
 
99
  <Typography variant="h4">Hi!👋</Typography>
100
  <div style={{ paddingTop: "10px" }}>
101
  <Typography fontSize={"20px"}>
102
+ This project is aiming to provide an easy way to reproduce a provided sound on the TAL-Noisemaker VST using a custom Inversynth model implementation
103
  </Typography>
104
  </div>
105
  </Box>
front/src/pages/Inference/CustomizeVST/CustomizeVST.tsx ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ DeveloperBoardOutlined
3
+ } from "@mui/icons-material";
4
+ import {
5
+ Box,
6
+ Button,
7
+ Card,
8
+ CardActions,
9
+ CardContent,
10
+ Checkbox,
11
+ Table,
12
+ TableBody,
13
+ TableCell,
14
+ TableContainer,
15
+ TableHead,
16
+ TableRow,
17
+ TextField,
18
+ Typography
19
+ } from "@mui/material";
20
+ import { useState } from "react";
21
+ import { Link } from "react-router-dom";
22
+ import MainContainer from "../../../components/Container/MainContainer";
23
+
24
+ const CustomizeVST = () => {
25
+ type DataType = {
26
+ [key: string]: number | number[];
27
+ };
28
+
29
+ const data: DataType = {
30
+ item1: 1,
31
+ item2: 42,
32
+ item3: 2,
33
+ item4: 7,
34
+ item5: [3, 2],
35
+ };
36
+
37
+ type Column = {
38
+ id: string;
39
+ label: string;
40
+ };
41
+
42
+ const columns: Column[] = [
43
+ { id: "checkbox", label: "Enabled" },
44
+ { id: "name", label: "Name" },
45
+ { id: "value", label: "Value" },
46
+ ];
47
+
48
+ const [selectedItems, setSelectedItems] = useState<string[]>([]);
49
+ const [editedValues, setEditedValues] = useState<DataType>({});
50
+
51
+ const handleCheckboxChange = (itemName: string) => {
52
+ if (selectedItems.includes(itemName)) {
53
+ setSelectedItems(selectedItems.filter((item) => item !== itemName));
54
+ } else {
55
+ setSelectedItems([...selectedItems, itemName]);
56
+ }
57
+ };
58
+
59
+ const handleValueChange = (itemName: string, value: number | number[]) => {
60
+ setEditedValues((prevValues) => ({
61
+ ...prevValues,
62
+ [itemName]: value,
63
+ }));
64
+ };
65
+
66
+ return (
67
+ <>
68
+ <MainContainer>
69
+ <Box
70
+ sx={{
71
+ justifyContent: "center",
72
+ display: "flex",
73
+ height: "99%",
74
+ alignItems: "center",
75
+ }}
76
+ >
77
+ <Card variant={"filled"} sx={{ width: "30vw" }}>
78
+ <Box>
79
+ <CardContent
80
+ sx={{
81
+ display: "grid",
82
+ justifyItems: "center",
83
+ alignItems: "center",
84
+ }}
85
+ >
86
+ <DeveloperBoardOutlined sx={{ fontSize: "50px" }} />
87
+ <Typography
88
+ sx={{ fontFamily: "monospace", pt: 1, fontSize: "50px" }}
89
+ >
90
+ VST Name
91
+ </Typography>
92
+ <Typography sx={{ fontFamily: "monospace", pb: 1 }}>
93
+ Properties available
94
+ </Typography>
95
+ <TableContainer sx={{}}>
96
+ <Table>
97
+ <TableHead>
98
+ <TableRow>
99
+ {columns.map((column) => (
100
+ <TableCell key={column.id}>{column.label}</TableCell>
101
+ ))}
102
+ </TableRow>
103
+ </TableHead>
104
+ <TableBody>
105
+ {Object.keys(data).map((itemName) => (
106
+ <TableRow key={itemName}>
107
+ <TableCell>
108
+ <Checkbox
109
+ checked={selectedItems.includes(itemName)}
110
+ onChange={() => handleCheckboxChange(itemName)}
111
+ />
112
+ </TableCell>
113
+ <TableCell>{itemName}</TableCell>
114
+ <TableCell>
115
+ {Array.isArray(data[itemName]) ? (
116
+ <>
117
+ <TextField
118
+ type="number"
119
+ value={
120
+ editedValues[itemName] !== undefined
121
+ ? editedValues[itemName]
122
+ : data[itemName]
123
+ }
124
+ onChange={(e) =>
125
+ handleValueChange(
126
+ itemName,
127
+ Number(e.target.value)
128
+ )
129
+ }
130
+ />
131
+ <TextField
132
+ type="number"
133
+ value={
134
+ editedValues[itemName] !== undefined
135
+ ? editedValues[itemName]
136
+ : data[itemName]
137
+ }
138
+ onChange={(e) =>
139
+ handleValueChange(
140
+ itemName,
141
+ Number(e.target.value)
142
+ )
143
+ }
144
+ />
145
+ </>
146
+ ) : (
147
+ <TextField
148
+ sx={{
149
+ width: "100px",
150
+ WebkitAppearance: "none",
151
+ margin: 0,
152
+ }}
153
+ type="number"
154
+ value={
155
+ editedValues[itemName] !== undefined
156
+ ? editedValues[itemName]
157
+ : data[itemName]
158
+ }
159
+ onChange={(e) =>
160
+ handleValueChange(
161
+ itemName,
162
+ Number(e.target.value)
163
+ )
164
+ }
165
+ />
166
+ )}
167
+ </TableCell>
168
+ </TableRow>
169
+ ))}
170
+ </TableBody>
171
+ </Table>
172
+ </TableContainer>
173
+ </CardContent>
174
+ <CardActions sx={{ display: "flex", justifyContent: "flex-end" }}>
175
+ <Button variant="filled" component={Link} to="/Results">
176
+ Next
177
+ </Button>
178
+ </CardActions>
179
+ </Box>
180
+ </Card>
181
+ </Box>
182
+ </MainContainer>
183
+ </>
184
+ );
185
+ };
186
+
187
+ export default CustomizeVST;
front/src/pages/Inference/Inference.tsx ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ Box,
3
+ LinearProgress,
4
+ Modal,
5
+ Typography
6
+ } from "@mui/material";
7
+ import { useCallback, useEffect, useState } from "react";
8
+ import { useLocation } from "react-router-dom";
9
+ import MainContainer from "../../components/Container/MainContainer";
10
+ import AudioUploader from "../../requests/upload";
11
+
12
+ const Inference = () => {
13
+
14
+
15
+ useEffect(() => {
16
+ // Retrieve values from localStorage
17
+ const storedFilePath = localStorage.getItem('file_path');
18
+ const storedCsvFilePath = localStorage.getItem('csv_file_path');
19
+ const storedOutputFilePath = localStorage.getItem('output_file_path');
20
+
21
+ // Check if values are stored and delete them
22
+ if (storedFilePath || storedCsvFilePath || storedOutputFilePath) {
23
+ localStorage.removeItem('file_path');
24
+ localStorage.removeItem('csv_file_path');
25
+ localStorage.removeItem('output_file_path');
26
+ }
27
+ }, []);
28
+
29
+
30
+ const location = useLocation();
31
+ const [selectedIndex, setSelectedIndex] = useState(
32
+ location.pathname.replace("/", "")
33
+ );
34
+
35
+ const [isVisible, setIsVisible] = useState(false);
36
+ const [files, setFile] = useState<File | null>(null);
37
+ const [filename, setFileName] = useState<string>("null");
38
+ const [NextCard, setNextCard] = useState(false);
39
+
40
+ const handleListItemClick = (index: string) => {
41
+ setSelectedIndex(index);
42
+ };
43
+
44
+ useEffect(() => {
45
+ setSelectedIndex(location.pathname.replace("/", ""));
46
+ }, [location.pathname]);
47
+
48
+
49
+ const uploadNow = () => {
50
+ //start upload function and pass the file selected as argument
51
+ };
52
+
53
+
54
+ const onDragEnter = useCallback(
55
+ (e: { stopPropagation: () => void; preventDefault: () => void }) => {
56
+ setIsVisible(true);
57
+ e.stopPropagation();
58
+ e.preventDefault();
59
+ return false;
60
+ },
61
+ []
62
+ );
63
+ const onDragOver = useCallback(
64
+ (e: { preventDefault: () => void; stopPropagation: () => void }) => {
65
+ e.preventDefault();
66
+ e.stopPropagation();
67
+ return false;
68
+ },
69
+ []
70
+ );
71
+ const onDragLeave = useCallback(
72
+ (e: { stopPropagation: () => void; preventDefault: () => void }) => {
73
+ setIsVisible(false);
74
+ e.stopPropagation();
75
+ e.preventDefault();
76
+ return false;
77
+ },
78
+ []
79
+ );
80
+ const onDrop = useCallback(
81
+ (e: { preventDefault: () => void; dataTransfer: any }) => {
82
+ e.preventDefault();
83
+ const files = e.dataTransfer.files;
84
+ setFile(e.dataTransfer.files[0]);
85
+ setFileName(e.dataTransfer.files[0].name);
86
+ console.log("Files dropped: ", filename);
87
+ // Upload files
88
+ //check file type
89
+ setNextCard(true);
90
+ setIsVisible(false);
91
+ return false;
92
+ },
93
+ []
94
+ );
95
+
96
+ useEffect(() => {
97
+ window.addEventListener("mouseup", onDragLeave);
98
+ window.addEventListener("dragenter", onDragEnter);
99
+ window.addEventListener("dragover", onDragOver);
100
+ window.addEventListener("drop", onDrop);
101
+ return () => {
102
+ window.removeEventListener("mouseup", onDragLeave);
103
+ window.removeEventListener("dragenter", onDragEnter);
104
+ window.removeEventListener("dragover", onDragOver);
105
+ window.removeEventListener("drop", onDrop);
106
+ };
107
+ }, [onDragEnter, onDragLeave, onDragOver, onDrop]);
108
+
109
+
110
+ //Modal OpenClose
111
+ const [openModal, setOpenModal] = useState(false);
112
+ const handleOpen = () => setOpenModal(true);
113
+ const handleClose = () => setOpenModal(false);
114
+
115
+ return (
116
+ <>
117
+ <MainContainer>
118
+ <Box
119
+ onDragEnter={onDragEnter}
120
+ onDragOver={onDragEnter}
121
+ onDragLeave={onDragLeave}
122
+ sx={{
123
+ justifyContent: "center",
124
+ display: "flex",
125
+ height: "99%",
126
+ alignItems: "center",
127
+ }}
128
+ >
129
+ <AudioUploader handleClose={handleClose} handleOpen={handleOpen}/>
130
+ </Box>
131
+ <GenerationModal GenerationStatus="It's working for sure" handleClose={handleClose} handleOpen={openModal}/>
132
+ </MainContainer>
133
+ </>
134
+ );
135
+ };
136
+
137
+ export default Inference;
138
+
139
+ interface GenerationModalProps {
140
+ GenerationStatus: string; // Replace "string" with the actual type of GenerationStatus
141
+ handleOpen : boolean;
142
+ handleClose: React.Dispatch<React.SetStateAction<boolean>>;
143
+ }
144
+
145
+ export function GenerationModal({
146
+ GenerationStatus,
147
+ handleOpen,
148
+ handleClose
149
+ }: GenerationModalProps): any {
150
+
151
+
152
+ const [statusText, setStatusText] = useState(GenerationStatus);
153
+
154
+ useEffect(() => {
155
+ // Update the displayText whenever the prop 'text' changes
156
+ setStatusText(GenerationStatus);
157
+ }, [GenerationStatus]);
158
+
159
+ return (
160
+ <div
161
+ style={{
162
+ display: "flex",
163
+ justifyContent: "center",
164
+ marginBottom: "10px",
165
+ }}
166
+ >
167
+ <Modal
168
+ open={handleOpen}
169
+ onClose={handleClose}
170
+ aria-labelledby="modal-modal-title"
171
+ aria-describedby="modal-modal-description"
172
+ >
173
+ <Box sx={style_modal}>
174
+ <Typography variant="h4">Model Running</Typography>
175
+ <div style={{ paddingTop: "10px" }}>
176
+ <Typography fontSize={"20px"}>{GenerationStatus}</Typography>
177
+ <Box sx={{ pt: 2 }}>
178
+ <LinearProgress color={"primary"} sx={{ borderRadius: "50px" }} />
179
+ </Box>
180
+ </div>
181
+ </Box>
182
+ </Modal>
183
+ </div>
184
+ );
185
+ }
186
+
187
+ const style_modal = {
188
+ position: "absolute" as "absolute",
189
+ top: "50%",
190
+ left: "50%",
191
+ transform: "translate(-50%, -50%)",
192
+ width: 500,
193
+ color: "inherit",
194
+ bgcolor: "background.paper",
195
+ p: 4,
196
+ borderRadius: "10px"
197
+ };
front/src/pages/Inference/Results/Results.tsx ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ Box,
3
+ Card,
4
+ CardContent,
5
+ Chip,
6
+ Divider,
7
+ Fab,
8
+ Grid,
9
+ LinearProgress,
10
+ Stack,
11
+ Typography,
12
+ } from "@mui/material";
13
+ import MainContainer from "../../../components/Container/MainContainer";
14
+ import {
15
+ Audiotrack,
16
+ ChecklistSharp,
17
+ DeveloperBoard,
18
+ FlashOn,
19
+ LineAxis,
20
+ Loop,
21
+ RestartAlt,
22
+ Settings,
23
+ SettingsTwoTone,
24
+ UploadFile,
25
+ } from "@mui/icons-material";
26
+ import { useCallback, useEffect, useState } from "react";
27
+ import { Link, useNavigate, useNavigation } from "react-router-dom";
28
+ import ReactAudioPlayer from "react-audio-player";
29
+
30
+ const Results = () => {
31
+ const navigate = useNavigate();
32
+
33
+ const handleRetry = () => {
34
+ // Implement retry logic here
35
+ console.log("Retry button clicked");
36
+ };
37
+
38
+ const [filePath, setFilePath] = useState("");
39
+ const [csvFilePath, setCsvFilePath] = useState(" ");
40
+ const [outputFilePath, setOutputFilePath] = useState(" ");
41
+
42
+ useEffect(() => {
43
+ // Retrieve values from localStorag
44
+ const storedFilePath = localStorage.getItem("file_path");
45
+ const storedCsvFilePath = localStorage.getItem("csv_file_path");
46
+ const storedOutputFilePath = localStorage.getItem("output_file_path");
47
+
48
+ // Function to replace backslashes with forward slashes
49
+ const convertSlashes = (path: string | null): string => {
50
+ if (path != null) {
51
+ return path.replace(/\\/g, "/");
52
+ }
53
+ return "";
54
+ };
55
+
56
+ // Update state variables with converted values
57
+ setFilePath(convertSlashes(localStorage.getItem("file_path")));
58
+ setCsvFilePath(convertSlashes(localStorage.getItem("csv_file_path")));
59
+ setOutputFilePath(convertSlashes(localStorage.getItem("output_file_path")));
60
+
61
+ // Check if any required values are missing
62
+ if (!storedFilePath || !storedCsvFilePath || !storedOutputFilePath) {
63
+ // Values are missing, redirect to another page (replace '/path-to-redirect' with the desired path)
64
+ navigate("/Inference");
65
+ }
66
+ }, []); // Empty dependency array ensures the useEffect runs only once on mount
67
+
68
+ return (
69
+ <MainContainer>
70
+ <Box
71
+ sx={{
72
+ justifyContent: "center",
73
+ display: "flex",
74
+ height: "99%",
75
+ alignItems: "center",
76
+ }}
77
+ >
78
+ <Stack sx={{ borderRadius: "12px", gap: "30px", alignItems: "center" }}>
79
+ <Grid
80
+ container
81
+ spacing={2}
82
+ alignItems="center"
83
+ justifyContent="center"
84
+ >
85
+ {/* Before Card */}
86
+ <Grid item>
87
+ <Card>
88
+ <CardContent>
89
+ <Typography sx={{ pt: 0.5, pb: 4 }} variant="h6">
90
+ Sample
91
+ </Typography>
92
+ {/* Add your audio player component for the 'before' state here */}
93
+ {/* Example: <AudioPlayer audioFile={beforeAudioFile} /> */}
94
+ <ReactAudioPlayer src={filePath} controls />
95
+ </CardContent>
96
+ </Card>
97
+ </Grid>
98
+
99
+ {/* Vertical Line Divider */}
100
+
101
+ {/* After Card */}
102
+ <Grid item>
103
+ <Card>
104
+ <CardContent>
105
+ <Typography sx={{ pt: 0.5, pb: 4 }} variant="h6">
106
+ Generated
107
+ </Typography>
108
+ {/* Add your audio player component for the 'before' state here */}
109
+ {/* Example: <AudioPlayer audioFile={beforeAudioFile} /> */}
110
+ <ReactAudioPlayer src={outputFilePath} controls />
111
+ </CardContent>
112
+ </Card>
113
+ </Grid>
114
+ </Grid>
115
+
116
+ {/* Retry FAB */}
117
+ <Fab
118
+ color="primary"
119
+ sx={{ height: "70px" }}
120
+ variant="extended"
121
+ component={Link}
122
+ target="_blank"
123
+ to={csvFilePath}
124
+ >
125
+ <Audiotrack />
126
+ <Typography
127
+ color="inherit"
128
+ sx={{ mr: 1, fontSize: 16, fontWeight: 500, mt: 0.3, ml: 2 }}
129
+ >
130
+ Download Preset
131
+ </Typography>
132
+ </Fab>
133
+ <Divider sx={{ width: "5vw", py: 2 }}>Or</Divider>
134
+ <Fab
135
+ color="surface"
136
+ sx={{ mt: 5, height: "70px" }}
137
+ variant="extended"
138
+ component={Link}
139
+ to="/Inference"
140
+ >
141
+ <RestartAlt />
142
+ <Typography
143
+ color="inherit"
144
+ sx={{ mr: 1, fontSize: 16, fontWeight: 500, mt: 0.3, ml: 2 }}
145
+ >
146
+ Retry
147
+ </Typography>
148
+ </Fab>
149
+ </Stack>
150
+ </Box>
151
+ </MainContainer>
152
+ );
153
+ };
154
+
155
+ export default Results;
156
+ function convertSlashes(
157
+ arg0: string | null
158
+ ): import("react").SetStateAction<string> {
159
+ throw new Error("Function not implemented.");
160
+ }
front/src/pages/Layout/MainLayout.tsx CHANGED
@@ -16,11 +16,16 @@ const MainLayout: FC = () => {
16
 
17
  const rootStyles: SxProps = {
18
  display: 'flex',
19
- minHeight: '100vh',
20
  };
21
  const navStyles: SxProps = {
22
- width: { md: drawerWidth },
23
- flexShrink: { md: 0 },
 
 
 
 
 
24
  };
25
 
26
  const mainStyles: SxProps = {
@@ -41,25 +46,15 @@ const MainLayout: FC = () => {
41
  return (
42
 
43
  <Box sx={rootStyles}>
44
- <Box component="nav" sx={navStyles}>
45
- {isSmUp ? null : (
46
- <MainDrawer
47
- PaperProps={{ style: { width: drawerWidth } }}
48
- variant="temporary"
49
- open={mobileOpen}
50
- onClose={handleDrawerToggle}
51
- />
52
- )}
53
- <MainDrawer variant="permanent"
54
- PaperProps={{ style: { width: drawerWidth } }}
55
- sx={{ display: { md: 'block', sm: 'none', xs: 'none' } }} />
56
- </Box>
57
  <Box sx={mainStyles}>
58
  <MainAppBar onDrawerToggle={handleDrawerToggle} />
59
  <Box sx={containerStyles}>
60
  <Outlet />
61
  </Box>
62
  </Box>
 
 
 
63
  </Box>
64
  );
65
  }
 
16
 
17
  const rootStyles: SxProps = {
18
  display: 'flex',
19
+ height: '100vh',
20
  };
21
  const navStyles: SxProps = {
22
+ width: "100vw",
23
+ position: "fixed",
24
+ bottom: "0",
25
+ display:"flex",
26
+ flexDirection:"row-reverse",
27
+ pb:3,
28
+ pr:2
29
  };
30
 
31
  const mainStyles: SxProps = {
 
46
  return (
47
 
48
  <Box sx={rootStyles}>
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  <Box sx={mainStyles}>
50
  <MainAppBar onDrawerToggle={handleDrawerToggle} />
51
  <Box sx={containerStyles}>
52
  <Outlet />
53
  </Box>
54
  </Box>
55
+ <Box sx={navStyles}>
56
+ <MainDrawer variant="permanent"/>
57
+ </Box>
58
  </Box>
59
  );
60
  }
front/src/pages/pagesData.tsx CHANGED
@@ -1,10 +1,10 @@
1
  import { routerType } from "../types/router.types";
2
  import About from "./About/About";
3
- import Inferrence from "./Inferrence/Inferrence";
4
  import Home from "./Home/Home";
5
  import Express from "./Express/Express";
6
- import Results from "./Inferrence/Results/Results";
7
- import CustomizeVST from "./Inferrence/CustomizeVST/CustomizeVST";
8
 
9
  const pagesData: routerType[] = [
10
  {
@@ -13,9 +13,9 @@ const pagesData: routerType[] = [
13
  title: "Home",
14
  },
15
  {
16
- path: "Inferrence",
17
- element: <Inferrence/>,
18
- title: "Inferrence"
19
  },
20
  {
21
  path: "About",
 
1
  import { routerType } from "../types/router.types";
2
  import About from "./About/About";
3
+ import Inference from "./Inference/Inference";
4
  import Home from "./Home/Home";
5
  import Express from "./Express/Express";
6
+ import Results from "./Inference/Results/Results";
7
+ import CustomizeVST from "./Inference/CustomizeVST/CustomizeVST";
8
 
9
  const pagesData: routerType[] = [
10
  {
 
13
  title: "Home",
14
  },
15
  {
16
+ path: "Inference",
17
+ element: <Inference/>,
18
+ title: "Inference"
19
  },
20
  {
21
  path: "About",
front/src/requests/download.tsx CHANGED
@@ -6,16 +6,18 @@ const AudioDownloader = () => {
6
 
7
  const [downloadUrl, setDownloadUrl] = useState<string | null>(null);
8
 
9
- const fileId = localStorage.getItem('uploadId');
10
- console.log('Retrieved Upload ID:', fileId);
 
11
 
12
  const handleDownload = async () => {
13
  try {
14
- const response = await axios.get(`https://yderre-aubay-infer-vst.hf.space/download/${fileId}`);
 
 
15
 
16
  // Assuming the response.data contains the URL
17
  const url = response.data.url;
18
- const server = 'https://yderre-aubay-infer-vst.hf.space/'
19
 
20
 
21
 
 
6
 
7
  const [downloadUrl, setDownloadUrl] = useState<string | null>(null);
8
 
9
+ const fileId = localStorage.getItem('uploadId');
10
+ console.log('Retrieved Upload ID:', fileId);
11
+
12
 
13
  const handleDownload = async () => {
14
  try {
15
+ const server = import.meta.env.VITE_API_URL;
16
+
17
+ const response = await axios.get(`${server}/download/${fileId}`);
18
 
19
  // Assuming the response.data contains the URL
20
  const url = response.data.url;
 
21
 
22
 
23
 
front/src/requests/upload.tsx CHANGED
@@ -16,6 +16,8 @@ import {
16
  Typography,
17
  CardActions,
18
  Button,
 
 
19
  } from "@mui/material";
20
  import { ThemeSchemeContext, ThemeModeContext } from "../theme";
21
 
@@ -31,10 +33,11 @@ const AudioUploader = ({ ...props }) => {
31
 
32
  const [audioFile, setAudioFile] = useState<File | null>(null);
33
 
 
34
  const [uploadStatus, setUploadStatus] = useState("");
35
  const inputFile = useRef<HTMLInputElement | null>(null);
36
 
37
- const [isModalOpen, setIsModalOpen] = useState(false);
38
 
39
  const onDragEnter = useCallback(
40
  (e: { stopPropagation: () => void; preventDefault: () => void }) => {
@@ -95,6 +98,10 @@ const AudioUploader = ({ ...props }) => {
95
  }
96
  };
97
 
 
 
 
 
98
  const onButtonClick = () => {
99
  // `current` points to the mounted file input element
100
  inputFile?.current?.click();
@@ -103,9 +110,12 @@ const AudioUploader = ({ ...props }) => {
103
  const handleUpload = async () => {
104
  if (audioFile) {
105
  try {
 
 
106
  const form = new FormData();
107
 
108
  if (audioFile) {
 
109
  const blob = new Blob([audioFile], {
110
  type: "application/octet-stream",
111
  });
@@ -116,7 +126,7 @@ const AudioUploader = ({ ...props }) => {
116
  }
117
 
118
  const response = await axios.post(
119
- "https://yderre-aubay-infer-vst.hf.space/upload/",
120
  form,
121
  {
122
  headers: { Accept: "multipart/form-data" },
@@ -148,6 +158,7 @@ const AudioUploader = ({ ...props }) => {
148
  console.error("Error:", error);
149
  props.handleClose();
150
  setIsError(true);
 
151
  setNextCard(false);
152
  setUploadStatus(`Error: ${error}`);
153
  }
@@ -170,7 +181,7 @@ const AudioUploader = ({ ...props }) => {
170
  <Typography gutterBottom variant="h5" sx={{ pb: 3 }}>
171
  {isVisible
172
  ? "Drop here to upload"
173
- : "Drag a file to start inferrence"}
174
  </Typography>
175
  <UploadFile sx={{ fontSize: "35px", color: "inherit" }} />
176
  </CardContent>
@@ -229,6 +240,16 @@ const AudioUploader = ({ ...props }) => {
229
  </CardActions>
230
  </Box>
231
  </Card>
 
 
 
 
 
 
 
 
 
 
232
  </Box>
233
  </>
234
  );
@@ -253,3 +274,17 @@ const PaletteSwatch = ({ onTitle, titleColor, onTitleColor, visible }: any) => {
253
  </Box>
254
  );
255
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  Typography,
17
  CardActions,
18
  Button,
19
+ Modal,
20
+ CircularProgress,
21
  } from "@mui/material";
22
  import { ThemeSchemeContext, ThemeModeContext } from "../theme";
23
 
 
33
 
34
  const [audioFile, setAudioFile] = useState<File | null>(null);
35
 
36
+
37
  const [uploadStatus, setUploadStatus] = useState("");
38
  const inputFile = useRef<HTMLInputElement | null>(null);
39
 
40
+ const [modalOpen, setModalOpen] = useState(false);
41
 
42
  const onDragEnter = useCallback(
43
  (e: { stopPropagation: () => void; preventDefault: () => void }) => {
 
98
  }
99
  };
100
 
101
+ const handleCloseModal = () => {
102
+ setModalOpen(false);
103
+ };
104
+
105
  const onButtonClick = () => {
106
  // `current` points to the mounted file input element
107
  inputFile?.current?.click();
 
110
  const handleUpload = async () => {
111
  if (audioFile) {
112
  try {
113
+ const server = import.meta.env.VITE_API_URL;
114
+
115
  const form = new FormData();
116
 
117
  if (audioFile) {
118
+ setModalOpen(true);
119
  const blob = new Blob([audioFile], {
120
  type: "application/octet-stream",
121
  });
 
126
  }
127
 
128
  const response = await axios.post(
129
+ `${server}/upload/`,
130
  form,
131
  {
132
  headers: { Accept: "multipart/form-data" },
 
158
  console.error("Error:", error);
159
  props.handleClose();
160
  setIsError(true);
161
+ setModalOpen(false);
162
  setNextCard(false);
163
  setUploadStatus(`Error: ${error}`);
164
  }
 
181
  <Typography gutterBottom variant="h5" sx={{ pb: 3 }}>
182
  {isVisible
183
  ? "Drop here to upload"
184
+ : "Drag a file to start inference"}
185
  </Typography>
186
  <UploadFile sx={{ fontSize: "35px", color: "inherit" }} />
187
  </CardContent>
 
240
  </CardActions>
241
  </Box>
242
  </Card>
243
+ <Modal
244
+ open={modalOpen}
245
+ onClose={handleCloseModal}
246
+ aria-labelledby="modal-modal-title"
247
+ aria-describedby="modal-modal-description"
248
+ >
249
+ <Box sx={style_modal}>
250
+ <CircularProgress size={60} thickness={4} />
251
+ </Box>
252
+ </Modal>
253
  </Box>
254
  </>
255
  );
 
274
  </Box>
275
  );
276
  };
277
+
278
+ const style_modal = {
279
+ position: "absolute" as "absolute",
280
+ top: "50%",
281
+ left: "50%",
282
+ transform: "translate(-50%, -50%)",
283
+ color: "inherit",
284
+ bgcolor: "background.paper",
285
+ p: 4,
286
+ borderRadius: "10px",
287
+ display: "flex",
288
+ justifyContent: "center",
289
+ alignTtems: "center",
290
+ };
front/tsconfig.json CHANGED
@@ -5,6 +5,7 @@
5
  "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
  "module": "ESNext",
7
  "skipLibCheck": true,
 
8
 
9
  /* Bundler mode */
10
  "moduleResolution": "bundler",
 
5
  "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
  "module": "ESNext",
7
  "skipLibCheck": true,
8
+ "types": ["vite/client"],
9
 
10
  /* Bundler mode */
11
  "moduleResolution": "bundler",