Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ if DEVICE == "auto":
|
|
14 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
15 |
print(f"[SYSTEM] | Using {DEVICE} type compute device.")
|
16 |
|
17 |
-
DEFAULT_INPUT = "Describe in one
|
18 |
MAX_FRAMES = 64
|
19 |
|
20 |
model_name = "openbmb/MiniCPM-o-2_6"
|
@@ -85,7 +85,7 @@ def generate(input, instruction=DEFAULT_INPUT, sampling=False, temperature=0.7,
|
|
85 |
image = Image.open(input).convert("RGB")
|
86 |
content.append(image)
|
87 |
elif filetype in ["Video", "GIF"]:
|
88 |
-
frames = encode_gif(input) if filetype == "GIF" else encode_video(
|
89 |
content.extend(frames)
|
90 |
audio = librosa.load(input, sr=16000, mono=True)
|
91 |
content.append(audio)
|
@@ -95,7 +95,7 @@ def generate(input, instruction=DEFAULT_INPUT, sampling=False, temperature=0.7,
|
|
95 |
else:
|
96 |
return "Unsupported file type."
|
97 |
|
98 |
-
filename = os.path.basename(
|
99 |
prefix = input_prefixes[filetype].replace("█", filename)
|
100 |
content.append(prefix + instruction)
|
101 |
inputs_payload = [{"role": "user", "content": content}]
|
|
|
14 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
15 |
print(f"[SYSTEM] | Using {DEVICE} type compute device.")
|
16 |
|
17 |
+
DEFAULT_INPUT = "Describe in one short sentence."
|
18 |
MAX_FRAMES = 64
|
19 |
|
20 |
model_name = "openbmb/MiniCPM-o-2_6"
|
|
|
85 |
image = Image.open(input).convert("RGB")
|
86 |
content.append(image)
|
87 |
elif filetype in ["Video", "GIF"]:
|
88 |
+
frames = encode_gif(input) if filetype == "GIF" else encode_video(input)
|
89 |
content.extend(frames)
|
90 |
audio = librosa.load(input, sr=16000, mono=True)
|
91 |
content.append(audio)
|
|
|
95 |
else:
|
96 |
return "Unsupported file type."
|
97 |
|
98 |
+
filename = os.path.basename(input)
|
99 |
prefix = input_prefixes[filetype].replace("█", filename)
|
100 |
content.append(prefix + instruction)
|
101 |
inputs_payload = [{"role": "user", "content": content}]
|