diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4c94526 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.8.16-slim-bullseye + +WORKDIR /app + +RUN apt-get update && apt-get install -y ffmpeg +RUN apt-get install -y portaudio19-dev +RUN apt-get install -y nodejs +RUN apt-get install -y npm +RUN npm install yarn -g +RUN npm install pm2 -g + +COPY . . + +WORKDIR /app/interface +RUN yarn install + +WORKDIR ../backend +RUN pip install wheel +RUN pip install -r requirements.txt + +WORKDIR /app + +CMD /bin/bash -c "cd backend && pm2 start 'flask --app app run --port 8000' --name=backend && cd ../interface && pm2-runtime start 'yarn start' --name=interface" \ No newline at end of file diff --git a/interface/package.json b/interface/package.json index b863c7c..724a931 100644 --- a/interface/package.json +++ b/interface/package.json @@ -19,12 +19,13 @@ "react-spinners": "^0.10.6" }, "scripts": { - "start": "react-scripts --openssl-legacy-provider start", + "start": "react-scripts start", "start-backend": "cd backend && source venv/bin/activate && python app.py", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, + "proxy": "http://0.0.0.0:8000", "eslintConfig": { "extends": "react-app" }, diff --git a/interface/src/App.js b/interface/src/App.js index 3741c7a..2607a76 100644 --- a/interface/src/App.js +++ b/interface/src/App.js @@ -104,7 +104,7 @@ const App = ({ classes }) => { formData.append("language", selectedLangRef.current) formData.append("model_size", modelOptions[selectedModelRef.current]) formData.append("audio_data", recordedBlob.blob, 'temp_recording'); - axios.post("http://0.0.0.0:8000/transcribe", formData, { headers }) + axios.post("/transcribe", formData, { headers }) .then((res) => { setTranscribedData(oldData => [...oldData, res.data]) setIsTranscribing(false) diff --git a/interface/src/utility_transcribe.js b/interface/src/utility_transcribe.js index 514cde9..17ec7b2 100644 --- a/interface/src/utility_transcribe.js +++ b/interface/src/utility_transcribe.js @@ -45,7 +45,7 @@ let RecorderObj = { const config = { headers: { 'content-type': 'multipart/form-data' } } - axios.post('http://localhost:8000/transcribe/', data, config); + axios.post('/transcribe', data, config); }, stopRecording: function () {