Spaces:
Running
on
T4
Running
on
T4
Add a length check
Browse files
app.py
CHANGED
|
@@ -12,6 +12,12 @@ else:
|
|
| 12 |
|
| 13 |
def _fn(path, solver, nfe, tau, denoising):
|
| 14 |
if path is None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
return None, None
|
| 16 |
|
| 17 |
solver = solver.lower()
|
|
|
|
| 12 |
|
| 13 |
def _fn(path, solver, nfe, tau, denoising):
|
| 14 |
if path is None:
|
| 15 |
+
gr.Warning("Please upload an audio file.")
|
| 16 |
+
return None, None
|
| 17 |
+
|
| 18 |
+
info = torchaudio.info(path)
|
| 19 |
+
if info.num_frames / info.sample_rate > 60:
|
| 20 |
+
gr.Warning("Only audio files shorter than 60 seconds are supported.")
|
| 21 |
return None, None
|
| 22 |
|
| 23 |
solver = solver.lower()
|