DurgaDeepak commited on
Commit
c0d825f
·
verified ·
1 Parent(s): b22cb66

Update core/input_handler.py

Browse files
Files changed (1) hide show
  1. core/input_handler.py +5 -5
core/input_handler.py CHANGED
@@ -121,7 +121,7 @@ def validate_video(path):
121
  return False, str(e)
122
 
123
  # Input Resolution
124
- def resolve_input(mode, uploaded_files, url):
125
  """
126
  Resolves the media input based on selected mode.
127
  - If mode is 'Upload', accepts either:
@@ -131,7 +131,7 @@ def resolve_input(mode, uploaded_files, url):
131
 
132
  Args:
133
  mode (str): 'Upload' or 'URL'
134
- uploaded_files (List[Union[PIL.Image.Image, str]]): Uploaded media
135
  url (str): URL to image or video
136
 
137
  Returns:
@@ -141,12 +141,12 @@ def resolve_input(mode, uploaded_files, url):
141
  logger.info(f"Resolving input for mode: {mode}")
142
 
143
  if mode == "Upload":
144
- if not uploaded_files:
145
  logger.warning("No upload detected.")
146
  return None
147
 
148
- image_files = [f for f in uploaded_files if isinstance(f, Image.Image)]
149
- video_files = [f for f in uploaded_files if isinstance(f, str) and f.lower().endswith((".mp4", ".mov", ".avi"))]
150
 
151
  if image_files and video_files:
152
  logger.warning("Mixed media upload not supported (images + video).")
 
121
  return False, str(e)
122
 
123
  # Input Resolution
124
+ def resolve_input(mode, media_upload, url):
125
  """
126
  Resolves the media input based on selected mode.
127
  - If mode is 'Upload', accepts either:
 
131
 
132
  Args:
133
  mode (str): 'Upload' or 'URL'
134
+ media_upload (List[Union[PIL.Image.Image, str]]): Uploaded media
135
  url (str): URL to image or video
136
 
137
  Returns:
 
141
  logger.info(f"Resolving input for mode: {mode}")
142
 
143
  if mode == "Upload":
144
+ if not media_upload:
145
  logger.warning("No upload detected.")
146
  return None
147
 
148
+ image_files = [f for f in media_upload if isinstance(f, Image.Image)]
149
+ video_files = [f for f in media_upload if isinstance(f, str) and f.lower().endswith((".mp4", ".mov", ".avi"))]
150
 
151
  if image_files and video_files:
152
  logger.warning("Mixed media upload not supported (images + video).")