diff --git a/app/README.md b/app/README.md index b02d932..c5759c3 100644 --- a/app/README.md +++ b/app/README.md @@ -4,9 +4,9 @@ emoji: 🐠 colorFrom: yellow colorTo: blue sdk: gradio -sdk_version: 6.7.0 +sdk_version: 6.20.0 app_file: app.py -python_version: 3.11 +python_version: 3.12.12 pinned: true license: cc --- diff --git a/app/app.py b/app/app.py index fd5e3c3..1b046b0 100644 --- a/app/app.py +++ b/app/app.py @@ -1,11 +1,18 @@ +import tensorflow as tf import gradio as gr from cqfe_utils import cqfe -cqfe_interface = gr.Interface(fn=cqfe, - inputs=gr.Audio(type='filepath', format='wav', label='Audio Input File'), - outputs=[gr.File(type='filepath', label='F0 Output Files'), - gr.Plot(label='F0 Estimation Plot')], - title="Choral Quartets F0 Extractor (v0.3.0)", - description="An application that uses Multi-Pitch Estimation and Voice Assignment to transform audio files with Choral Quartets recordings into files (CSV, HDF5 and MIDI) containing F0 estimations for each voice (Soprano, Alto, Tenor and Bass). The processing may take a few minutes.") if __name__ == "__main__": + physical_devices = tf.config.list_physical_devices('GPU') + if physical_devices: + tf.config.experimental.set_memory_growth(physical_devices[0], True) + + cqfe_interface = gr.Interface(fn=cqfe, + inputs=gr.Audio(type='filepath', format='wav', label='Audio Input File'), + outputs=[gr.File(type='filepath', label='F0 Output Files'), + gr.Plot(label='F0 Estimation Plot')], + title="Choral Quartets F0 Extractor (v0.4.0)", + description="An application that uses Multi-Pitch Estimation and Voice Assignment to transform audio files with Choral Quartets recordings into files (CSV, HDF5 and MIDI) containing F0 estimations for each voice (Soprano, Alto, Tenor and Bass). The processing may take a few minutes.") + + cqfe_interface.launch(share=True) \ No newline at end of file diff --git a/app/cqfe_utils.py b/app/cqfe_utils.py index bcfbb71..7eb8cb8 100644 --- a/app/cqfe_utils.py +++ b/app/cqfe_utils.py @@ -2,6 +2,7 @@ import math import mido import pumpp +import spaces import librosa import numpy as np import pandas as pd @@ -222,6 +223,7 @@ def compute_pump_features(pump, audio_fpath): ############################################################ +@spaces.GPU(duration=60) def get_mpe_prediction(model, audio_file=None): """Generate output from a model given an input numpy file. Part of this function is part of deepsalience @@ -259,6 +261,7 @@ def get_mpe_prediction(model, audio_file=None): ############################################################ +@spaces.GPU(duration=60) def get_va_prediction(model, f0_matrix): splits = f0_matrix.shape[1]//256 splits_diff = 256 - (f0_matrix.shape[1] - splits * 256) diff --git a/app/pyproject.toml b/app/pyproject.toml index caa95a1..fb543b4 100644 --- a/app/pyproject.toml +++ b/app/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "Choral-Quartets-F0-Extractor" -version = "0.3.0" +version = "0.4.0" description = "An application that uses Multi-Pitch Estimation and Voice Assignment to transform audio files with Choral Quartets recordings into files (CSV, HDF5 and MIDI) containing F0 estimations for each voice (Soprano, Alto, Tenor and Bass)." authors = ["André Paiva (Xornotor) "] license = "cc" @@ -8,9 +8,9 @@ readme = "README.md" packages = [{include = "Choral_Quartets_F0_Extractor"}] [tool.poetry.dependencies] -python = "^3.11" +python = "^3.12.12" tensorflow-cpu = "^2.14" -gradio = "^6.7" +gradio = "^6.20" typing-extensions = "^4.15" mido = "^1.3.3" pumpp = "^0.6" @@ -20,8 +20,9 @@ pandas = "^2.2" hdf5plugin = "^4.4" h5py = "^3.9" tables = "^3.9" -librosa = "^0.10" +librosa = "^0.11" matplotlib = "^3.8" +spaces = "^0.51.1" [build-system] requires = ["poetry-core"] diff --git a/app/requirements.txt b/app/requirements.txt index 2de9f2d..2483987 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1,5 +1,5 @@ -tensorflow-cpu==2.14.0 -gradio==6.7.0 +tensorflow==2.14.0 +gradio==6.20.0 typing-extensions==4.15 mido==1.3.3 pumpp==0.6.0 @@ -9,6 +9,7 @@ pandas==2.2.2 hdf5plugin==4.4.0 h5py==3.9.0 tables==3.9.2 -soundfile==0.13.1 +soundfile==0.14.0 librosa==0.11.0 matplotlib==3.8.0 +spaces==0.51.1 diff --git a/requirements.txt b/requirements.txt index 31f7c10..4156efd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,14 +13,14 @@ seaborn==0.13.2 jupyterlab==4.5.10 ipywidgets==8.1.1 librosa==0.11.0 -mir_eval==0.7 -ray==2.54.0 +mir_eval==0.8.2 +ray==2.56.1 tensorflow==2.14.0 tensorboard==2.14.0 scikit-learn==1.5.1 -gradio==6.7.0 -pyarrow==17.0.0 -typing-extensions==4.8.0 +gradio==6.20.0 +pyarrow==25.0.0 +typing-extensions==4.15 pydantic==2.8.2 pydantic-core==2.20.1 pillow==12.3.0 @@ -31,7 +31,7 @@ muda==0.4.1 pescador==3.0.0 pumpp==0.6.0 pysoundfile==0.9.0.post1 -soundfile==0.13.1, +soundfile==0.14.0, sox==1.5.0 samplerate==0.2.1 resampy==0.4.3