Spaces:
Running
on
CPU Upgrade
Review DB management
Hey @mrfakename ! Sorry in advance if this PR has a lot of changes.
I've started by removing the os.getenv('HF_TOKEN')
parts since token retrieval is automatically done by huggingface_hub
.
Then I refactored a bit the "sync DB" part to use the CommitScheduler
helper. It does something very similar to what you were doing but with some other built-in features as well (especially do not commit if no changes detected => do not pollute history. It also have a lock mechanism to avoid modifying the database.db file while uploading it).
And finally I made a bit of renaming to avoid confusing the 2 datasets (the audio samples on one side and the DB on the other side).
Hope you find this PR useful. I'm fine with making some changes (or reverting some) if you prefer. Please let me know :)
Thanks for the PR!!