KingNish commited on
Commit
2dd16b6
·
verified ·
1 Parent(s): dd07a7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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 isinstance(media, Image.Image):
42
  media_type = "image"
43
- elif isinstance(media, str) and media.endswith((".mp4", ".webm", ".avi")): # 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,7 +54,7 @@ def qwen_inference(media, text_input=None):
54
  {
55
  "type": media_type,
56
  media_type: media_path,
57
- **({"max_pixels": 360 * 420, "fps": 6.0} if media_type == "video" else {}),
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
  ],