Surn commited on
Commit
4f37585
1 Parent(s): b76a81b

Light Anti-hacking update

Browse files
Files changed (2) hide show
  1. app.py +5 -0
  2. audiocraft/utils/extend.py +1 -1
app.py CHANGED
@@ -84,6 +84,11 @@ def predict(model, text, melody, duration, dimension, topk, topp, temperature, c
84
  else:
85
  if MOVE_TO_CPU:
86
  MODEL.to('cuda')
 
 
 
 
 
87
 
88
  output = None
89
  segment_duration = duration
 
84
  else:
85
  if MOVE_TO_CPU:
86
  MODEL.to('cuda')
87
+
88
+ # prevent hacking
89
+ duration = min(duration, 720)
90
+ overlap = min(overlap, 15)
91
+ #
92
 
93
  output = None
94
  segment_duration = duration
audiocraft/utils/extend.py CHANGED
@@ -18,7 +18,7 @@ INTERRUPTING = False
18
  def separate_audio_segments(audio, segment_duration=30, overlap=1):
19
  sr, audio_data = audio[0], audio[1]
20
 
21
- total_samples = len(audio_data)
22
  segment_samples = sr * segment_duration
23
  overlap_samples = sr * overlap
24
 
 
18
  def separate_audio_segments(audio, segment_duration=30, overlap=1):
19
  sr, audio_data = audio[0], audio[1]
20
 
21
+ total_samples = min(len(audio_data), 25)
22
  segment_samples = sr * segment_duration
23
  overlap_samples = sr * overlap
24