Spaces:
Runtime error
Runtime error
Hendrik Schroeter commited on
Commit ·
42ea010
1
Parent(s): 031a5ff
Try to cleanup some stuff
Browse files12345678138 unmodified lines147148149147148150151152153154155156157158159160161162import globimport mathimport osimport tempfileimport timefrom typing import Optional, Tuple, Union
import gradio as gr138 unmodified lines ax_enh.clear() noisy_im = spec_im(sample, sr=sr, figure=fig_noisy, ax=ax_noisy) enh_im = spec_im(enhanced, sr=sr, figure=fig_enh, ax=ax_enh) # noisy_wav = gr.make_waveform(noisy_fn, bar_count=200) # enh_wav = gr.make_waveform(enhanced_fn, bar_count=200) # Cleanup some old wav files if os.path.exists("/tmp"): days = 1 for f in glob.glob("/tmp/*wav"): is_old = (time.time() - os.path.getmtime(f)) / 3600 > 24 * days if is_old and f not in (enhanced_wav, noisy_wav): try: os.remove(f) except Exception as e: print(f"failed to remove file {f}: e") return noisy_wav, noisy_im, enhanced_wav, enh_im
app.py+13-2