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

Fall 2022 Work #53

Open
wants to merge 118 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 97 commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
18df8ef
local env setup
TerryL99 Nov 5, 2022
3a7b54c
edit app.py & firestore.rules
TerryL99 Nov 9, 2022
cc017f0
Merge branch 'main' of github.com:Li-Haowei/se-bch-als-msg-banking in…
TerryL99 Nov 9, 2022
91eedbd
Merge branch 'main' of github.com:Li-Haowei/se-bch-als-msg-banking
TerryL99 Nov 9, 2022
00e55f9
test files
Li-Haowei Nov 17, 2022
48d888e
pause test yml on pushes
Li-Haowei Nov 17, 2022
6ece7de
pause push github actions
Li-Haowei Nov 17, 2022
d8fe74b
try jest
Li-Haowei Nov 17, 2022
f1308c8
change some ymls
Li-Haowei Nov 17, 2022
91d3231
push test
Li-Haowei Nov 17, 2022
eb8003d
push test
Li-Haowei Nov 17, 2022
9bcf4d5
should be passing
Li-Haowei Nov 17, 2022
4b2f6bf
Update push-test.yml
Li-Haowei Nov 17, 2022
b9564bf
Update push-test.yml
Li-Haowei Nov 17, 2022
2dc1074
Update push-test.yml
Li-Haowei Nov 17, 2022
071be96
Update push-test.yml
Li-Haowei Nov 17, 2022
93af240
Update package.json
Li-Haowei Nov 17, 2022
0c69486
Update push-test.yml
Li-Haowei Nov 17, 2022
d6ea23c
Update push-test.yml
Li-Haowei Nov 17, 2022
a85006a
Update push-test.yml
Li-Haowei Nov 17, 2022
890dafb
Update push-test.yml
Li-Haowei Nov 17, 2022
157cc9a
Update push-test.yml
Li-Haowei Nov 17, 2022
e4f880f
Update package.json
Li-Haowei Nov 17, 2022
ea41a49
Update package.json
Li-Haowei Nov 17, 2022
ca212df
Update push-test.yml
Li-Haowei Nov 17, 2022
43dac51
Update push-test.yml
Li-Haowei Nov 17, 2022
1da632b
Update push-test.yml
Li-Haowei Nov 17, 2022
884b5a1
Update push-test.yml
Li-Haowei Nov 17, 2022
27162a5
Update push-test.yml
Li-Haowei Nov 17, 2022
bac65bb
Update push-test.yml
Li-Haowei Nov 17, 2022
1ca2139
Update push-test.yml
Li-Haowei Nov 17, 2022
f2e8c15
Update push-test.yml
Li-Haowei Nov 17, 2022
af2fd8d
Update push-test.yml
Li-Haowei Nov 17, 2022
5755616
Update push-test.yml
Li-Haowei Nov 17, 2022
ce943bd
Update push-test.yml
Li-Haowei Nov 17, 2022
ea6f6e6
Update push-test.yml
Li-Haowei Nov 17, 2022
635964d
Update push-test.yml
Li-Haowei Nov 17, 2022
da2206b
Update push-test.yml
Li-Haowei Nov 17, 2022
c178033
Update push-test.yml
Li-Haowei Nov 17, 2022
c00979e
Update package.json
Li-Haowei Nov 18, 2022
e06d963
Update push-test.yml
Li-Haowei Nov 18, 2022
d26e240
Update push-test.yml
Li-Haowei Nov 18, 2022
60d197a
Update package.json
Li-Haowei Nov 18, 2022
7d28b2d
Update package.json
Li-Haowei Nov 18, 2022
2fd0acd
Update push-test.yml
Li-Haowei Nov 18, 2022
02fc405
Update push-test.yml
Li-Haowei Nov 18, 2022
06286aa
Update package.json
Li-Haowei Nov 18, 2022
2845658
Update push-test.yml
Li-Haowei Nov 18, 2022
360fcbc
Update push-test.yml
Li-Haowei Nov 18, 2022
4a53f6c
Update package.json
Li-Haowei Nov 18, 2022
af0b969
Update push-test.yml
Li-Haowei Nov 18, 2022
49a2d06
Update package.json
Li-Haowei Nov 18, 2022
2a5695f
Update package.json
Li-Haowei Nov 18, 2022
05918a1
Update package.json
Li-Haowei Nov 18, 2022
beac1ca
Update .gitignore
Li-Haowei Nov 18, 2022
de7ecb2
Update package.json
Li-Haowei Nov 18, 2022
17c62ae
Update push-test.yml
Li-Haowei Nov 18, 2022
728332b
jest 24
Li-Haowei Nov 18, 2022
66ad9dd
Update package.json
Li-Haowei Nov 18, 2022
4d41337
Update package.json
Li-Haowei Nov 18, 2022
af05eef
Update push-test.yml
Li-Haowei Nov 18, 2022
41e3052
Update package.json
Li-Haowei Nov 18, 2022
fa6595f
Update push-test.yml
Li-Haowei Nov 18, 2022
55a07eb
solver for filename issue
Li-Haowei Nov 18, 2022
231e714
Merge branch 'main' of https://github.com/Li-Haowei/se-bch-als-msg-ba…
Li-Haowei Nov 18, 2022
9119775
firebase 9.0.2
Li-Haowei Nov 18, 2022
74479e0
Update package.json
Li-Haowei Nov 18, 2022
2deab2a
remove jest
Li-Haowei Nov 18, 2022
24b8aa5
deletion working for old data structure
danieldelijani Nov 18, 2022
563dc17
Merge branch 'main' of https://github.com/Li-Haowei/se-bch-als-msg-ba…
danieldelijani Nov 18, 2022
36c4376
Completed backend deletion and frontend function
danieldelijani Nov 19, 2022
1e4d165
Merge branch 'main' of github.com:Li-Haowei/se-bch-als-msg-banking in…
TerryL99 Nov 21, 2022
93e0690
delete unprocessed file and front end finish
Li-Haowei Nov 22, 2022
874fb7b
(work not done) added react-collapsed; changed "audio" type to list i…
shaolin-x Nov 28, 2022
c98c10b
basic functionalities completed; changed react version back
shaolin-x Nov 29, 2022
64081a0
creating account
Li-Haowei Nov 29, 2022
e795c7f
fixed single file upload
Li-Haowei Nov 29, 2022
6d69914
change requirements.txt & settings.js
TerryL99 Nov 29, 2022
4319193
Merge branch 'main' of github.com:Li-Haowei/se-bch-als-msg-banking in…
TerryL99 Nov 29, 2022
cc046bb
TODO: make UI nicer; fix delete audios
shaolin-x Nov 30, 2022
2e55f73
Fix delete_unprocessed_audio
danieldelijani Dec 1, 2022
80b51f7
Merge branch 'RetrieveUI' of https://github.com/Li-Haowei/se-bch-als-…
danieldelijani Dec 1, 2022
da27dad
updated retrive format
shaolin-x Dec 1, 2022
baa608c
Merge branch 'RetrieveUI' of https://github.com/Li-Haowei/se-bch-als-…
shaolin-x Dec 1, 2022
9e9fa3a
Add blob.delete to app.py
danieldelijani Dec 1, 2022
d308437
Merge branch 'RetrieveUI' of https://github.com/Li-Haowei/se-bch-als-…
danieldelijani Dec 1, 2022
124fb19
Update next steps in README
danieldelijani Dec 4, 2022
db6e8fe
Merge branch 'main' of https://github.com/Li-Haowei/se-bch-als-msg-ba…
danieldelijani Dec 4, 2022
2bf5992
looks great
shaolin-x Dec 4, 2022
b35557e
Merge remote-tracking branch 'origin/main' into RetrieveUI
shaolin-x Dec 4, 2022
33af9e5
merged with main
shaolin-x Dec 4, 2022
0be6995
audio upload finished
Li-Haowei Dec 4, 2022
eb83a79
Update app.py
Li-Haowei Dec 4, 2022
e973ee0
change file name format
Li-Haowei Dec 4, 2022
5662c86
Update frontend UI for home page
TerryL99 Dec 5, 2022
0bc28b3
Merge branch 'main' of github.com:Li-Haowei/se-bch-als-msg-banking in…
TerryL99 Dec 5, 2022
0ec42d4
Update frontend ui for dashboard page
TerryL99 Dec 5, 2022
3e1bff3
fixed audio splicing
shaolin-x Dec 5, 2022
e46ee09
Merge branch 'main' of https://github.com/Li-Haowei/se-bch-als-msg-ba…
shaolin-x Dec 5, 2022
0309546
added mui/system package
shaolin-x Dec 5, 2022
7f13db3
made Navbar look nicer
shaolin-x Dec 5, 2022
a01364a
small fixes on frontend presentation
shaolin-x Dec 5, 2022
e2fd810
Update ui for dashboard page
TerryL99 Dec 5, 2022
cb64c9a
Merge branch 'main' of github.com:Li-Haowei/se-bch-als-msg-banking in…
TerryL99 Dec 5, 2022
964f65d
updated home
shaolin-x Dec 5, 2022
5034f44
remove console.log from retrieve.js
danieldelijani Dec 8, 2022
275b396
deprecated all otherlogin methods except google
shaolin-x Dec 9, 2022
13f5769
Merge branch 'main' of https://github.com/Li-Haowei/se-bch-als-msg-ba…
shaolin-x Dec 9, 2022
065210a
Update firebase-hosting-merge.yml
Li-Haowei Dec 12, 2022
4f3634c
revert back to older version
Li-Haowei Dec 12, 2022
d75698c
Update myModuleResolver.js
Li-Haowei Dec 12, 2022
ca4d991
Update myModuleResolver.js
Li-Haowei Dec 12, 2022
36ad9c6
made next steps in documentation more verbose
danieldelijani Dec 12, 2022
5b39088
Note that mui/styles is a legacy library
danieldelijani Dec 12, 2022
ba70210
Left comments on delete_unprocessed_audio
danieldelijani Dec 12, 2022
8326048
add docs for delete un/processed audio
danieldelijani Dec 12, 2022
2d57af4
fix eslint issue
danieldelijani Dec 12, 2022
cb3df0a
fix loading windows in Retrieve.js and Upload.js
shaolin-x Dec 17, 2022
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
94 changes: 47 additions & 47 deletions .github/workflows/add_collaborators.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
# Author: Rishab
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore the original version of this file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented them out since the github action runs everytime we push and it slow down my testing on my unit test yml. I have reverted it back to older version

name: Add Collaborators v1.1
# # Author: Rishab
# name: Add Collaborators v1.1

on:
push:
branches:
- master
- main
- dev
# on:
# push:
# branches:
# - master
# - main
# - dev

jobs:
add-collaborators:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Add Collaborators
uses: actions/[email protected]
with:
github-token: ${{secrets.ADMIN_GITHUB_TOKEN}}
script: |
const fs = require('fs');
const readline = require('readline');
const readInterface = readline.createInterface({
input: fs.createReadStream('./COLLABORATORS'),
output: process.stdout,
console: false
});
readInterface.on('line', async function(line) {
try {
await github.repos.checkCollaborator({
owner: context.repo.owner,
repo: context.repo.repo,
username: line,
});
} catch(err) {
console.log(err)
if(err.toString() === "HttpError: Not Found"){
await github.repos.addCollaborator({
owner: context.repo.owner,
repo: context.repo.repo,
username: line,
permission: 'push'
});
} else {
core.setFailed(err.toString())
}
# jobs:
# add-collaborators:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Repo
# uses: actions/checkout@v2
# - name: Add Collaborators
# uses: actions/[email protected]
# with:
# github-token: ${{secrets.ADMIN_GITHUB_TOKEN}}
# script: |
# const fs = require('fs');
# const readline = require('readline');
# const readInterface = readline.createInterface({
# input: fs.createReadStream('./COLLABORATORS'),
# output: process.stdout,
# console: false
# });
# readInterface.on('line', async function(line) {
# try {
# await github.repos.checkCollaborator({
# owner: context.repo.owner,
# repo: context.repo.repo,
# username: line,
# });
# } catch(err) {
# console.log(err)
# if(err.toString() === "HttpError: Not Found"){
# await github.repos.addCollaborator({
# owner: context.repo.owner,
# repo: context.repo.repo,
# username: line,
# permission: 'push'
# });
# } else {
# core.setFailed(err.toString())
# }

}
});
# }
# });

2 changes: 1 addition & 1 deletion .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

name: Deploy to Firebase Hosting on merge
"on":
push:
merge:
Li-Haowei marked this conversation as resolved.
Show resolved Hide resolved
branches:
- main
jobs:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/push-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Author: Haowei Li
# (It seems like a trend for yml that people put names, so I do it too)

# The purpose of this yml file is to run some tests on the client to see if everything runs as supposed to
# client is based on React.JS
name: Unit Test
on:
push:
branches:
- main
- dev
defaults:
run:
working-directory: client
jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: '14.x'

- name: npm install, build, and test
run: |
npm install
npm install [email protected]
npm test
#npm install [email protected]
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/__pycache__
*/tmp
package-lock.json
settings.js
serviceaccount.json
client/src/components/settings.js
*/coverage
client/package-lock.json
client/src/components/settings.js
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ gcloud run deploy api-dev \

### Next Steps

- Create different user types, with support for different user permissions
- Motivation: so patients and caretakers can both upload/manage files on behalf of the patient
- Suggested direction
- Currently, the ERD of the system looks as follows: [link](https://excalidraw.com/#json=-LCSG-ShDmak9AprUI9LT,zhR7TQiJovH9fbLHI2MJsA)
- A modification of the database and user flow to follow this general guideline would allow for these features to be built, as this would allow both patients and caretakers to upload/retrieve from the same document within the newly created collections: [link](https://excalidraw.com/#json=21EzZvSgTpRM558zRtxWx,e5qdQqTUEmp2myNCfwgo-g)
- Develop additional audio processing features:
- Background noise reduction
- Improve the clarity of slurred subject voice
- Other features:
- Folder layout in processed files pages
- User is able to delete processed files
- User input in trimming/splitting process

- User input in trimming/splitting process
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please expand this section to be more verbose and better explain why the user features are needed etc. Talk about use cases etc

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

97 changes: 83 additions & 14 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os
import datetime
from flask import Flask, request, jsonify
from flask_cors import CORS
from google.cloud import firestore
import google.auth.transport.requests
from google.oauth2 import id_token
Expand Down Expand Up @@ -158,6 +157,7 @@ def upload_audios():
return 'Unauthorized', 401
user_ref = users_collection.document(claims['sub'])
doc = user_ref.get()
# return {str(doc)}, 200
if doc.exists:
doc = doc.to_dict()
for file in files:
Expand All @@ -171,30 +171,28 @@ def upload_audios():
# upload processed audio
for path in processedFilePaths:
dest_processed_file = f'Audio{uuid.uuid1()}.wav'
processedFileName = path.split('/tmp/')[1]
originalFileName = path.split('/tmp/')[1]
blob = bucket.blob(dest_processed_file)
blob.upload_from_filename(path, content_type='audio/wav')
created = False
if "audio" in doc:
doc["audio"].append({processedFileName: destination_file_name, "processed": {dest_processed_file}})
# check if file already exists
for audio in doc["audio"]:
if destination_file_name in str(list(audio.values())):
created = True
audio["processed"].append(dest_processed_file)
if not created:
doc["audio"].append({originalFileName: destination_file_name, "processed": [dest_processed_file]})
user_ref.update({"audio": doc["audio"]})
else:
user_ref.update({"audio": [{processedFileName: destination_file_name, "processed "+ destination_file_name: {dest_processed_file}}]})
doc = user_ref.get()
doc = doc.to_dict()
# if "audio" in doc:
# doc["audio"].append({file.filename: destination_file_name})
# user_ref.update({"audio": doc["audio"]})
# else:
# user_ref.update({"audio": [{file.filename: destination_file_name}]})
user_ref.update({"audio": [{originalFileName: destination_file_name, "processed": [dest_processed_file]}]})
return {'message': 'Files uploaded successfully'}, 200
else:
print(u'No such document!')
return {'message': 'No such document'}, 400


# Get Audio


@app.route('/retrieve_audio', methods=['POST'])
def retrieve_audio():
fileName = request.json['fileName']
Expand All @@ -208,7 +206,78 @@ def retrieve_audio():
print("Generated GET signed URL:")
return url

@app.route('/delete_unprocessed_audio', methods=['DELETE'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation on the expected form of the HTTP request. Should provide an example HTTP request.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

def delete_unprocessed_audio():
# In firebase, under audio, there is a list of uploaded audio,
# each uploaded audio has two entries: the original audio file name and "processed".
# The original audio file is by itself like "name":"address",
# while the "processed" is a list containing the names of the processed audio files like "processed":"[address1, address2, address2]".

cloud_storage_filename = request.json['cloudStorageFileName']
auth_header = request.json['Authorization']

# delete the audio from cloud storage
blob = bucket.blob(cloud_storage_filename)
blob.delete()

# delete the audio from firebase, and the associated processed audios from cloud storage
idtoken = auth_header.split(' ').pop()
claims = id_token.verify_firebase_token(
idtoken, HTTP_REQUEST, audience=os.environ.get('GOOGLE_CLOUD_PROJECT'))
user_ref = users_collection.document(claims['sub'])

doc = user_ref.get()
if doc.exists:
doc = doc.to_dict()
new_audios = []
for audio in doc["audio"]:
if cloud_storage_filename not in list(audio.values()):
new_audios.append(audio)
Comment on lines +243 to +244
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you do this? It seems that the user could pass in arbitrary audio file names and they could get appended to the users list of audio. Which would not be valid since they would not actually exist.

It seems you should check if the passed audio is in the list, if it's not then that's an error. Since we must use the database as the single source of truth since it's the only thing that keeps data on what audio belongs to each person.

Copy link

@danieldelijani danieldelijani Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Audio is an example audio already existing in the user's document (see lines 229-233, these get the user doc, then the audios). So, this line is seeing if the unprocessed audio is part of this given unprocessed/processed audio combination. Then, if it is not it appends it to new_audios which is becomes the new list of audios in the firebase.

else:
# delete the processed audios from cloud storage
for processed_audio in audio["processed"]:
blob = bucket.blob(processed_audio)
blob.delete()

user_ref.update({'audio': new_audios})
return {'message': "Success"}, 200
else:
print(u'No such document!')
return {'message': 'No such document'}, 400


@app.route('/delete_processed_audio', methods=['DELETE'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function does the same thing as the other one. Please find a way to not duplicate the code. Instead, maybe write an inner function that you pass a parameter of some sort to etc. If you're copying and pasting code you're doing something wrong (: (Normally but not always)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They have some slight differences. We have changed the database a little bit, and yes, there is more elegant way of combining them, but they are essentially deleting different things so we figured it is better having two of them separated to avoid future confusion

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment in the code on what the slight difference is! The next team will need to know.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Left extensive comments.

def delete_processed_audio():
# get request data
cloud_storage_filename = request.json['cloudStorageFileName']
auth_header = request.json['Authorization']

# delete the audio from cloud storage
blob = bucket.blob(cloud_storage_filename)
blob.delete()

# delete the audio from firebase, and the associated processed audios from cloud storage
idtoken = auth_header.split(' ').pop()
claims = id_token.verify_firebase_token(
idtoken, HTTP_REQUEST, audience=os.environ.get('GOOGLE_CLOUD_PROJECT'))
user_ref = users_collection.document(claims['sub'])

doc = user_ref.get()
if doc.exists:
doc = doc.to_dict()
for audio in doc["audio"]:
if cloud_storage_filename in audio['processed']:
audio['processed'].remove(cloud_storage_filename)

user_ref.update({'audio': doc['audio']})
return {'message': 'File deleted successfully'}, 200

else:
print(u'No such document!')
return {'message': 'No such document'}, 400



port = int(os.environ.get('PORT', 8080))
if __name__ == '__main__':
app.run(threaded=True, host='0.0.0.0', port=port)
app.run(threaded=True, host='0.0.0.0', port=port, debug=True)
IanSaucy marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 4 additions & 3 deletions backend/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def deadSpace(filePath):

sample_rate = 48000

prepPath = '/tmp/' + re.split('.wav|.WAV', (filePath.split('/tmp/')[1]))[0] + 'Edited.WAV'

#prepPath = '/tmp/' + re.split('.wav|.WAV', (filePath.split('/tmp/')[1]))[0] + 'Edited.WAV' # the original way that append "Edited" each chunk
prepPath = '/tmp/' + re.split('.wav|.WAV', (filePath.split('/tmp/')[1]))[0] + '.WAV'
Comment on lines +24 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the file does not end in .wav?

Copy link
Collaborator Author

@Li-Haowei Li-Haowei Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still .wav, we just remove "Edited" since there are original clip and processed clip stored and displayed separately

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My question was more, what happens if the user uploads something that is not a .wav file? Recall that any frontend verification can always be bypassed so the API should not trust any data it receives.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump @Li-Haowei

# Preparation of wav file for vad function
# pySeg = AudioSegment.from_wav(filePath).set_channels(1).set_frame_rate(sample_rate).export(prepPath, format='wav')
pySeg = AudioSegment.from_file(filePath).set_channels(1).set_frame_rate(sample_rate).export(prepPath, format='wav')
Expand All @@ -40,7 +40,8 @@ def deadSpace(filePath):

# Writes voice audio chunks + appends valid files
for i, segment in enumerate(segments):
path = prepPath.split('.WAV')[0] + 'chunk-'+ str(i) + '.WAV'
# path = prepPath.split('.WAV')[0] + 'chunk-'+ str(i) + '.WAV' # the original way that indexes each chunk
path = prepPath.split('.WAV')[0] + '.WAV'
print(' Writing %s' % (path))
vadfuncs.write_wave(path, segment, sample_rate)

Expand Down
2 changes: 2 additions & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ google-auth
google-cloud-firestore
google-cloud-storage
pydub
ffprobe
ffmpeg
webrtcvad

4 changes: 4 additions & 0 deletions client/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Reference: https://forum.codewithmosh.com/t/7-social-tests-still-referenceerror-regeneratorruntime-is-not-defined-resolved/1978
{
"plugins": ["@babel/plugin-transform-runtime"]
}
19 changes: 19 additions & 0 deletions client/myModuleResolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// my-module-resolve.js
module.exports = (request, options) => {
// Call the defaultResolver, so we leverage its cache, error handling, etc.
return options.defaultResolver(request, {
...options,
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
packageFilter: pkg => {
if(pkg.name.startsWith('@firebase')) {
return {
...pkg,
// Alter the value of `main` before resolving the package
main: pkg.esm5 || pkg.module,
};
}

return pkg;
},
});
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment in this file on why this file exists

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just added comments

Loading