jykoh commited on
Commit
f5c5aaa
·
1 Parent(s): 5b4ede2

Add minimum of 1 word to generate

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -81,7 +81,7 @@ def generate_for_prompt(input_text, state, ret_scale_factor, max_nm_rets, num_wo
81
 
82
  print('Running model.generate_for_images_and_texts with', model_inputs, flush=True)
83
  model_outputs = model.generate_for_images_and_texts(model_inputs,
84
- num_words=num_words, ret_scale_factor=ret_scale_factor, top_p=top_p,
85
  temperature=temperature, max_num_rets=max_nm_rets)
86
  print('model_outputs', model_outputs, flush=True)
87
 
@@ -130,7 +130,7 @@ with gr.Blocks(css=css) as demo:
130
  with gr.Column(scale=0.3, min_width=100):
131
  ret_scale_factor = gr.Slider(minimum=0.0, maximum=3.0, value=1.0, step=0.1, interactive=True, label="Multiplier for returning images (higher means more frequent)")
132
  max_ret_images = gr.Number(minimum=0, maximum=3, value=1, precision=1, interactive=True, label="Max images to return")
133
- gr_max_len = gr.Number(value=32, precision=1, label="Max # of words returned", interactive=True)
134
  gr_temperature = gr.Number(value=0.0, label="Temperature", interactive=True)
135
 
136
  with gr.Column(scale=0.7, min_width=400):
 
81
 
82
  print('Running model.generate_for_images_and_texts with', model_inputs, flush=True)
83
  model_outputs = model.generate_for_images_and_texts(model_inputs,
84
+ num_words=max(num_words, 1), ret_scale_factor=ret_scale_factor, top_p=top_p,
85
  temperature=temperature, max_num_rets=max_nm_rets)
86
  print('model_outputs', model_outputs, flush=True)
87
 
 
130
  with gr.Column(scale=0.3, min_width=100):
131
  ret_scale_factor = gr.Slider(minimum=0.0, maximum=3.0, value=1.0, step=0.1, interactive=True, label="Multiplier for returning images (higher means more frequent)")
132
  max_ret_images = gr.Number(minimum=0, maximum=3, value=1, precision=1, interactive=True, label="Max images to return")
133
+ gr_max_len = gr.Slider(minimum=1, maximum=64, value=32, step=1, interactive=True, label="Max # of words returned")
134
  gr_temperature = gr.Number(value=0.0, label="Temperature", interactive=True)
135
 
136
  with gr.Column(scale=0.7, min_width=400):