tunght commited on
Commit
eb3a93e
·
1 Parent(s): 140a47c
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -113,7 +113,7 @@ def detect_features(image_paths):
113
  except Exception as e:
114
  print(e.__class__, e)
115
  traceback.print_exc()
116
- return None, None
117
 
118
 
119
  def generate(features, image, structure, reference, model, temperature):
@@ -121,8 +121,8 @@ def generate(features, image, structure, reference, model, temperature):
121
  image_features, base64_images = detect_features(image)
122
  detected_features = ""
123
  intended_use = ""
124
- alt_texts = ""
125
- if image_features is not None:
126
  alt_texts = image_features["alt_text"]
127
  detected_features = ", ".join(image_features["features"])
128
  intended_use = "Intended use: " + ", ".join(image_features["intended_use"])
 
113
  except Exception as e:
114
  print(e.__class__, e)
115
  traceback.print_exc()
116
+ return "", []
117
 
118
 
119
  def generate(features, image, structure, reference, model, temperature):
 
121
  image_features, base64_images = detect_features(image)
122
  detected_features = ""
123
  intended_use = ""
124
+ alt_texts = []
125
+ if image_features is not None and len(image_features) > 0:
126
  alt_texts = image_features["alt_text"]
127
  detected_features = ", ".join(image_features["features"])
128
  intended_use = "Intended use: " + ", ".join(image_features["intended_use"])