enhuiz commited on
Commit
aa1731e
1 Parent(s): 693611a

Add a length check

Browse files
Files changed (1) hide show
  1. app.py +6 -0
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()