SlangLab-NU / VoiceCollector

Apache License 2.0
1 stars 0 forks source link

Made modifications to work with Minio locally #19

Closed aanchan closed 1 year ago

aanchan commented 1 year ago

This is a working version with Minio.

I followed the steps here to set up Minio locally on the Mac: https://simonjcarr.medium.com/running-s3-object-storage-locally-with-minio-f50540ffc239

For the python code integration I followed the Minio documentation from here : https://min.io/docs/minio/linux/developers/python/minio-py.html

I created a bucket named local-s3 as it appears here on the Minio console:

Screen Shot 2023-08-10 at 1 20 22 PM

The file test27.wav was written locally after a recording was completed.

This was my local .env file:

S3_HOSTNAME='localhost:9000'
S3_BUCKET='local-s3'
REGION_NAME=''
S3_ACCESS_KEY='admin'
S3_SECRET_KEY='password'
SECURE=False

Here is the log as the file was received in the backend:

Level: INFO
Time: 2023-08-10 13:13:21,871
Logger: speak
Path: length_check:9
Function :get_audio_length
Message: duration (s): 3.24

000000111000000000000001111111111+(0.6900000000000004)11111110001111111111111110111111111111111111111111111111111101111111111111-(3.2099999999999937)
Level: INFO
Time: 2023-08-10 13:13:21,873
Logger: speak
Path: silence_check:165
Function :get_silence_ratio
Message: Voiced frames count: 82

Level: INFO
Time: 2023-08-10 13:13:21,873
Logger: speak
Path: silence_check:166
Function :get_silence_ratio
Message: Total frames count: 107

Level: INFO
Time: 2023-08-10 13:13:21,873
Logger: speak
Path: silence_check:168
Function :get_silence_ratio
Message: Silence ratio: 0.23

Level: INFO
Time: 2023-08-10 13:13:21,879
Logger: werkzeug
Path: _internal:224
Function :_log
Message: 127.0.0.1 - - [10/Aug/2023 13:13:21] "POST /api/v1/speak/submit/test27.346380584624885.webm HTTP/1.1" 200 -
macarious commented 1 year ago

I have reviewed the code, and changed 2 lines in server/app/scripts/db_helper.py so the False is no longer hard-coded. I was also able to run the code with a MinIO server without errors:

Successfully saved the audio file locally to MinIO: MinIO-Client-Interface

Submitted successfully through the web application: Web-voice-submitted

Log from server:

Level: INFO
Time: 2023-08-11 09:04:39,085
Logger: speak
Path: length_check:9
Function :get_audio_length
Message: duration (s): 2.7

00000000000000000000000000000000000001111111111+(1.1100000000000008)111111111111111111111111111111111111111111-(2.6699999999999973)
Level: INFO
Time: 2023-08-11 09:04:39,088
Logger: speak
Path: silence_check:165
Function :get_silence_ratio
Message: Voiced frames count: 52

Level: INFO
Time: 2023-08-11 09:04:39,089
Logger: speak
Path: silence_check:166
Function :get_silence_ratio
Message: Total frames count: 89

Level: INFO
Time: 2023-08-11 09:04:39,089
Logger: speak
Path: silence_check:168
Function :get_silence_ratio
Message: Silence ratio: 0.42

Level: INFO
Time: 2023-08-11 09:04:39,104
Logger: werkzeug
Path: _internal:224
Function :_log
Message: 127.0.0.1 - - [11/Aug/2023 09:04:39] "POST /api/v1/speak/submit/test6.194589849758225.webm HTTP/1.1" 200 -

Level: INFO
Time: 2023-08-11 09:06:46,680
Logger: werkzeug
Path: _internal:224
Function :_log
Message:  * Detected change in 'C:\\Users\\macar\\Documents\\SlangLab-NU\\VoiceCollector\\server\\app\\scripts\\db_helper.py', reloading

Level: INFO
Time: 2023-08-11 09:06:46,714
Logger: werkzeug
Path: _internal:224
Function :_log
Message:  * Restarting with stat

Level: WARNING
Time: 2023-08-11 09:06:47,161
Logger: werkzeug
Path: _internal:224
Function :_log
Message:  * Debugger is active!

Level: INFO
Time: 2023-08-11 09:06:47,163
Logger: werkzeug
Path: _internal:224
Function :_log
Message:  * Debugger PIN: 800-430-275