Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -90,11 +90,13 @@ def generate(input, instruction=DEFAULT_INPUT, sampling=False, temperature=0.7,
|
|
90 |
elif filetype == "Video":
|
91 |
frames = encode_video(input)
|
92 |
content.extend(frames)
|
93 |
-
|
94 |
-
|
|
|
95 |
elif filetype == "Audio":
|
96 |
-
|
97 |
-
|
|
|
98 |
else:
|
99 |
return "Unsupported file type."
|
100 |
|
|
|
90 |
elif filetype == "Video":
|
91 |
frames = encode_video(input)
|
92 |
content.extend(frames)
|
93 |
+
audio_np, sample_rate = librosa.load(input, sr=16000, mono=True)
|
94 |
+
audio_tensor = torch.from_numpy(audio_np).float().to(DEVICE)
|
95 |
+
content.append({"array": audio_tensor, "sampling_rate": sample_rate})
|
96 |
elif filetype == "Audio":
|
97 |
+
audio_np, sample_rate = librosa.load(input, sr=16000, mono=True)
|
98 |
+
audio_tensor = torch.from_numpy(audio_np).float().to(DEVICE)
|
99 |
+
content.append({"array": audio_tensor, "sampling_rate": sample_rate})
|
100 |
else:
|
101 |
return "Unsupported file type."
|
102 |
|