Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -38,9 +38,9 @@ def save_media_and_get_path(media, media_type):
|
|
38 |
|
39 |
@spaces.GPU
|
40 |
def qwen_inference(media, text_input=None):
|
41 |
-
if
|
42 |
media_type = "image"
|
43 |
-
elif
|
44 |
media_type = "video"
|
45 |
else:
|
46 |
raise ValueError("Unsupported media type. Please upload an image or video.")
|
@@ -54,7 +54,7 @@ def qwen_inference(media, text_input=None):
|
|
54 |
{
|
55 |
"type": media_type,
|
56 |
media_type: media_path,
|
57 |
-
**({"max_pixels":
|
58 |
},
|
59 |
{"type": "text", "text": text_input},
|
60 |
],
|
|
|
38 |
|
39 |
@spaces.GPU
|
40 |
def qwen_inference(media, text_input=None):
|
41 |
+
if media.endswith(Image.registered_extensions()):
|
42 |
media_type = "image"
|
43 |
+
elif media.endswith(("avi", "mp4", "mov", "mkv", "flv", "wmv", "mjpeg", "wav", "gif", "webm", "m4v", "3gp")): # Check if it's a video path
|
44 |
media_type = "video"
|
45 |
else:
|
46 |
raise ValueError("Unsupported media type. Please upload an image or video.")
|
|
|
54 |
{
|
55 |
"type": media_type,
|
56 |
media_type: media_path,
|
57 |
+
**({"max_pixels": 500 * 500, "fps": 8.0} if media_type == "video" else {}),
|
58 |
},
|
59 |
{"type": "text", "text": text_input},
|
60 |
],
|