Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,19 +52,19 @@ def generate(input=[], instruction=DEFAULT_INPUT, sampling=False, temperature=0.
|
|
| 52 |
print(instruction)
|
| 53 |
|
| 54 |
content = []
|
| 55 |
-
if not
|
| 56 |
return "No input provided."
|
| 57 |
|
| 58 |
-
for
|
| 59 |
-
ext = os.path.splitext(
|
| 60 |
if ext in [".jpg", ".jpeg", ".png", ".bmp", ".gif"]:
|
| 61 |
-
img = Image.open(
|
| 62 |
content.append(img)
|
| 63 |
elif ext in [".mp4", ".mov", ".avi", ".mkv"]:
|
| 64 |
-
frames = encode_video(
|
| 65 |
content.extend(frames)
|
| 66 |
elif ext in [".wav", ".mp3", ".flac", ".aac"]:
|
| 67 |
-
aud, _ = librosa.load(
|
| 68 |
content.append(aud)
|
| 69 |
else:
|
| 70 |
continue
|
|
|
|
| 52 |
print(instruction)
|
| 53 |
|
| 54 |
content = []
|
| 55 |
+
if not input:
|
| 56 |
return "No input provided."
|
| 57 |
|
| 58 |
+
for path in input:
|
| 59 |
+
ext = os.path.splitext(path)[1].lower()
|
| 60 |
if ext in [".jpg", ".jpeg", ".png", ".bmp", ".gif"]:
|
| 61 |
+
img = Image.open(path).convert("RGB")
|
| 62 |
content.append(img)
|
| 63 |
elif ext in [".mp4", ".mov", ".avi", ".mkv"]:
|
| 64 |
+
frames = encode_video(path)
|
| 65 |
content.extend(frames)
|
| 66 |
elif ext in [".wav", ".mp3", ".flac", ".aac"]:
|
| 67 |
+
aud, _ = librosa.load(path, sr=16000, mono=True)
|
| 68 |
content.append(aud)
|
| 69 |
else:
|
| 70 |
continue
|