small bug fix, check changelog tab
Browse files
app.py
CHANGED
@@ -219,16 +219,19 @@ def check_for_remaining_wav_or_mp3_files(which_filetype):
|
|
219 |
return f"There are {len(audio_files)} leftover files."
|
220 |
|
221 |
def display_audio_spectrogram(audio_file):
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
232 |
|
233 |
with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") as app:
|
234 |
gr.HTML(
|
@@ -351,6 +354,7 @@ with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") a
|
|
351 |
gr.Image(label="Spectrogram result", show_download_button=False, scale=2)
|
352 |
)
|
353 |
with gr.TabItem("Changelog"):
|
|
|
354 |
gr.Markdown("v0.97 - Added new spectrogram tool in Misc Tools and removed pitch analyzer as it did not fit with the purpose of this Space.")
|
355 |
gr.Markdown("v0.96 - Added new remaining files tool in Misc Tools.")
|
356 |
gr.Markdown("v0.95 - Fixed issue with mp3 files not downloading audio properly.")
|
|
|
219 |
return f"There are {len(audio_files)} leftover files."
|
220 |
|
221 |
def display_audio_spectrogram(audio_file):
|
222 |
+
if audio_file == None:
|
223 |
+
raise gr.Error("Cannot leave WAV field empty! Please insert a WAV file.")
|
224 |
+
else:
|
225 |
+
y, sr = librosa.load(audio_file)
|
226 |
+
d = librosa.amplitude_to_db(np.abs(librosa.stft(y)), ref=np.max)
|
227 |
+
plt.figure(figsize=(12, 8))
|
228 |
+
librosa.display.specshow(d, sr=sr, x_axis="time", y_axis="log")
|
229 |
+
plt.colorbar(format="%+2.0f db")
|
230 |
+
plt.title("Spectrogram")
|
231 |
+
output = "spectrogram.png"
|
232 |
+
plt.savefig(output)
|
233 |
+
plt.close()
|
234 |
+
return output
|
235 |
|
236 |
with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") as app:
|
237 |
gr.HTML(
|
|
|
354 |
gr.Image(label="Spectrogram result", show_download_button=False, scale=2)
|
355 |
)
|
356 |
with gr.TabItem("Changelog"):
|
357 |
+
gr.Markdown("v0.97a - Fixed issue with spectrogram tab if no WAV file was selected.")
|
358 |
gr.Markdown("v0.97 - Added new spectrogram tool in Misc Tools and removed pitch analyzer as it did not fit with the purpose of this Space.")
|
359 |
gr.Markdown("v0.96 - Added new remaining files tool in Misc Tools.")
|
360 |
gr.Markdown("v0.95 - Fixed issue with mp3 files not downloading audio properly.")
|