jykoh commited on
Commit
f1245a8
1 Parent(s): 094cad5

CSS updates for zooming

Browse files
Files changed (2) hide show
  1. app.py +9 -8
  2. fromage/models.py +1 -1
app.py CHANGED
@@ -26,7 +26,9 @@ css = """
26
  #share-btn:hover {
27
  background-image: linear-gradient(to right bottom, rgba(110,197,224, 0.9), rgba(138,211,194, 1.0));
28
  }
29
- #gallery img:hover {transform: scale(4.0);}
 
 
30
  """
31
 
32
  examples = [
@@ -182,10 +184,9 @@ with gr.Blocks(css=css) as demo:
182
  gr_temperature = gr.Slider(
183
  minimum=0.0, maximum=1.0, value=0.0, interactive=True, label="Temperature (0 for deterministic, higher for more randomness)")
184
 
185
- with gr.Row():
186
- gallery = gr.Gallery(
187
- value=[Image.open(e) for e in examples], label="Example Conversations", show_label=True, elem_id="gallery",
188
- ).style(grid=[5], height="auto")
189
 
190
  text_input.submit(generate_for_prompt, [text_input, gr_state, ret_scale_factor,
191
  max_ret_images, gr_max_len, gr_temperature], [gr_state, chatbot, share_group, save_group])
@@ -201,6 +202,6 @@ with gr.Blocks(css=css) as demo:
201
  save_button.click(None, [], [], _js=save_js)
202
 
203
 
204
- demo.queue(concurrency_count=1, api_open=False, max_size=16)
205
- demo.launch(debug=True, server_name="0.0.0.0")
206
- # demo.launch(debug=True, server_name="127.0.0.1")
 
26
  #share-btn:hover {
27
  background-image: linear-gradient(to right bottom, rgba(110,197,224, 0.9), rgba(138,211,194, 1.0));
28
  }
29
+ #gallery { z-index: 999999; }
30
+ #gallery img:hover {transform: scale(2.3); z-index: 999999; position: relative; padding-right: 30%; padding-bottom: 30%;}
31
+ #gallery button img:hover {transform: none; z-index: 999999; position: relative; padding-right: 0; padding-bottom: 0;}
32
  """
33
 
34
  examples = [
 
184
  gr_temperature = gr.Slider(
185
  minimum=0.0, maximum=1.0, value=0.0, interactive=True, label="Temperature (0 for deterministic, higher for more randomness)")
186
 
187
+ gallery = gr.Gallery(
188
+ value=[Image.open(e) for e in examples], label="Example Conversations", show_label=True, elem_id="gallery",
189
+ ).style(grid=[2], height="auto")
 
190
 
191
  text_input.submit(generate_for_prompt, [text_input, gr_state, ret_scale_factor,
192
  max_ret_images, gr_max_len, gr_temperature], [gr_state, chatbot, share_group, save_group])
 
202
  save_button.click(None, [], [], _js=save_js)
203
 
204
 
205
+ # demo.queue(concurrency_count=1, api_open=False, max_size=16)
206
+ # demo.launch(debug=True, server_name="0.0.0.0")
207
+ demo.launch(debug=True, server_name="127.0.0.1")
fromage/models.py CHANGED
@@ -640,7 +640,7 @@ def load_fromage(embeddings_dir: str, model_args_path: str, model_ckpt_path: str
640
  assert len(ret_token_idx) == 1, ret_token_idx
641
  model_kwargs['retrieval_token_idx'] = ret_token_idx[0]
642
 
643
- debug = False
644
  if debug:
645
  model_kwargs['opt_version'] = 'facebook/opt-125m'
646
  model_kwargs['visual_encoder'] = 'openai/clip-vit-base-patch32'
 
640
  assert len(ret_token_idx) == 1, ret_token_idx
641
  model_kwargs['retrieval_token_idx'] = ret_token_idx[0]
642
 
643
+ debug = True
644
  if debug:
645
  model_kwargs['opt_version'] = 'facebook/opt-125m'
646
  model_kwargs['visual_encoder'] = 'openai/clip-vit-base-patch32'