Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I added Dockerfile + proxy for cors issue #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 2 additions & 1 deletion interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion interface/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion interface/src/utility_transcribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down