Spaces:
Runtime error
Runtime error
Update app.py
Browse files10 unmodified lines1112131415161752 unmodified lines707172727374757677787943 unmodified lines123124125124125126127128129100 unmodified lines23023123223323423523623723823924010 unmodified linesimport reimport requestsimport timeimport gc
# Import necessary functions and classesfrom utils import load_t5, load_clap52 unmodified lines global global_model, current_model_name if global_model is not None: del global_model torch.cuda.empty_cache() global_model = None current_model_name = None torch.cuda.empty_cache() gc.collect()
def load_model(model_name, device, model_url=None): global global_model, current_model_name43 unmodified lines load_time = end_time - start_time return f"Successfully loaded model: {model_name} in {load_time:.2f} seconds" except Exception as e: global_model = None current_model_name = None unload_current_model() print(f"Error loading model {model_name}: {str(e)}") return f"Failed to load model: {model_name}. Error: {str(e)}"
100 unmodified lines
all_waveforms.append(waveform)
# Clear some memory after each segment del images, latents, mel_spectrogram, x_i torch.cuda.empty_cache() gc.collect()
# Concatenate all waveforms final_waveform = np.concatenate(all_waveforms)
app.py+9-3