Spaces:
Runtime error
Runtime error
crypto-code
commited on
Commit
•
c4f1082
1
Parent(s):
9013494
Update app.py
Browse files
app.py
CHANGED
@@ -250,23 +250,13 @@ def predict(
|
|
250 |
video = read_video_pyav(container=container, indices=indices)
|
251 |
|
252 |
if uid in generated_audio_files and len(generated_audio_files[uid]) != 0:
|
253 |
-
audio_length_in_s = min(get_audio_length(generated_audio_files[uid][-1]), 30)
|
254 |
sample_rate = 24000
|
255 |
waveform, sr = torchaudio.load(generated_audio_files[uid][-1])
|
256 |
if sample_rate != sr:
|
257 |
waveform = torchaudio.functional.resample(waveform, orig_freq=sr, new_freq=sample_rate)
|
258 |
audio = torch.mean(waveform, 0)
|
259 |
-
audio_length_in_s = min(int(len(audio)//sample_rate), 30)
|
260 |
-
print(f"Audio Length: {audio_length_in_s}")
|
261 |
else:
|
262 |
generated_audio_files[uid] = []
|
263 |
-
if video_path is not None:
|
264 |
-
audio_length_in_s = min(get_video_length(video_path), 30)
|
265 |
-
print(f"Video Length: {audio_length_in_s}")
|
266 |
-
if audio_path is not None:
|
267 |
-
audio_length_in_s = min(get_audio_length(audio_path), 30)
|
268 |
-
generated_audio_files[uid].append(audio_path)
|
269 |
-
print(f"Audio Length: {audio_length_in_s}")
|
270 |
|
271 |
print(image, video, audio)
|
272 |
response = model.generate(prompts, audio, image, video, 200, temperature, top_p,
|
|
|
250 |
video = read_video_pyav(container=container, indices=indices)
|
251 |
|
252 |
if uid in generated_audio_files and len(generated_audio_files[uid]) != 0:
|
|
|
253 |
sample_rate = 24000
|
254 |
waveform, sr = torchaudio.load(generated_audio_files[uid][-1])
|
255 |
if sample_rate != sr:
|
256 |
waveform = torchaudio.functional.resample(waveform, orig_freq=sr, new_freq=sample_rate)
|
257 |
audio = torch.mean(waveform, 0)
|
|
|
|
|
258 |
else:
|
259 |
generated_audio_files[uid] = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
|
261 |
print(image, video, audio)
|
262 |
response = model.generate(prompts, audio, image, video, 200, temperature, top_p,
|