fix issue with long text

#34
by makram93 - opened
Files changed (1) hide show
  1. custom_st.py +6 -5
custom_st.py CHANGED
@@ -72,14 +72,15 @@ class Transformer(nn.Module):
72
  response = requests.get(clean_text)
73
  texts[i] = Image.open(BytesIO(response.content)).convert("RGB")
74
  image_indices.append(i)
75
- elif Path(clean_text).is_file():
76
  try:
77
- texts[i] = Image.open(clean_text).convert("RGB")
78
- image_indices.append(i)
 
 
 
79
  except Exception as e:
80
  text_indices.append(i)
81
- else:
82
- text_indices.append(i)
83
  elif isinstance(text, Image.Image):
84
  image_indices.append(i)
85
  else:
 
72
  response = requests.get(clean_text)
73
  texts[i] = Image.open(BytesIO(response.content)).convert("RGB")
74
  image_indices.append(i)
75
+ else:
76
  try:
77
+ if Path(clean_text).is_file():
78
+ texts[i] = Image.open(clean_text).convert("RGB")
79
+ image_indices.append(i)
80
+ else:
81
+ text_indices.append(i)
82
  except Exception as e:
83
  text_indices.append(i)
 
 
84
  elif isinstance(text, Image.Image):
85
  image_indices.append(i)
86
  else: