davidberenstein1957 HF staff commited on
Commit
c39cd57
·
1 Parent(s): 8fbb3e4

add logic to catch tuple conversion too

Browse files
Files changed (1) hide show
  1. app/app.py +2 -2
app/app.py CHANGED
@@ -102,13 +102,13 @@ def _is_file_safe(path) -> bool:
102
  try:
103
  return Path(path).is_file()
104
  except Exception:
105
- return False
106
 
107
 
108
  def _process_content(content) -> str | list[str]:
109
  if isinstance(content, str) and _is_file_safe(content):
110
  return _convert_path_to_data_uri(content)
111
- elif isinstance(content, list):
112
  return _convert_path_to_data_uri(content[0])
113
  return content
114
 
 
102
  try:
103
  return Path(path).is_file()
104
  except Exception:
105
+ return ""
106
 
107
 
108
  def _process_content(content) -> str | list[str]:
109
  if isinstance(content, str) and _is_file_safe(content):
110
  return _convert_path_to_data_uri(content)
111
+ elif isinstance(content, list) or isinstance(content, tuple):
112
  return _convert_path_to_data_uri(content[0])
113
  return content
114