jykoh commited on
Commit
dc20f5f
·
1 Parent(s): 2425b09

UI changes

Browse files
Files changed (3) hide show
  1. app.py +1 -1
  2. fromage/models.py +1 -2
  3. fromage/utils.py +1 -0
app.py CHANGED
@@ -142,7 +142,7 @@ with gr.Blocks(css=css) as demo:
142
 
143
  with gr.Column(scale=0.7, min_width=400):
144
  image_btn = gr.UploadButton("🖼️ Image Input", file_types=["image"])
145
- text_input = gr.Textbox(label="Chat Input", lines=1, placeholder="Upload an image above [optional]. Then enter a text prompt, and press enter!")
146
 
147
  with gr.Row():
148
  with gr.Column(scale=0.33):
 
142
 
143
  with gr.Column(scale=0.7, min_width=400):
144
  image_btn = gr.UploadButton("🖼️ Image Input", file_types=["image"])
145
+ text_input = gr.Textbox(label="Type a message", lines=1, placeholder="Upload an image above [optional]. Then enter a text prompt, and press enter!")
146
 
147
  with gr.Row():
148
  with gr.Column(scale=0.33):
fromage/models.py CHANGED
@@ -585,8 +585,7 @@ class Fromage(nn.Module):
585
  seen_image_idx.append(img_idx)
586
  img = utils.get_image_from_url(self.path_array[img_idx])
587
  image_outputs.append(img)
588
- if len(image_outputs) == max_num_rets:
589
- break
590
  except UnidentifiedImageError:
591
  pass
592
 
 
585
  seen_image_idx.append(img_idx)
586
  img = utils.get_image_from_url(self.path_array[img_idx])
587
  image_outputs.append(img)
588
+ break
 
589
  except UnidentifiedImageError:
590
  pass
591
 
fromage/utils.py CHANGED
@@ -32,6 +32,7 @@ def get_image_from_url(url: str):
32
 
33
  def truncate_caption(caption: str) -> str:
34
  """Truncate captions at periods and newlines."""
 
35
  trunc_index = caption.find('\n') + 1
36
  if trunc_index <= 0:
37
  trunc_index = caption.find('.') + 1
 
32
 
33
  def truncate_caption(caption: str) -> str:
34
  """Truncate captions at periods and newlines."""
35
+ caption = caption.strip()
36
  trunc_index = caption.find('\n') + 1
37
  if trunc_index <= 0:
38
  trunc_index = caption.find('.') + 1