anilbhatt1 commited on
Commit
2d1ea08
Β·
verified Β·
1 Parent(s): 543c43d

App.py modified to append "Please describe this image." text if image only is received as input

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -185,6 +185,13 @@ def gradio_get_answers_fn(image=None, audio=None, text=None):
185
  if text:
186
  text_tokens = tokenizer.encode(text)
187
 
 
 
 
 
 
 
 
188
  if image or audio or text:
189
  input_embed = prepare_input_embed(image, audio_tokens, text_tokens)
190
  with torch.no_grad():
 
185
  if text:
186
  text_tokens = tokenizer.encode(text)
187
 
188
+ if image:
189
+ if audio or text:
190
+ pass
191
+ else:
192
+ text = "Please describe this image."
193
+ text_tokens = tokenizer.encode(text)
194
+
195
  if image or audio or text:
196
  input_embed = prepare_input_embed(image, audio_tokens, text_tokens)
197
  with torch.no_grad():