4rtemi5 commited on
Commit
d8e1186
1 Parent(s): e44c759

allow pixel size 10 and cache get_heatmap

Browse files
Files changed (1) hide show
  1. localization.py +2 -2
localization.py CHANGED
@@ -73,7 +73,7 @@ def gen_image_batch(image_url, image_size=224, pixel_size=10):
73
 
74
  return image_batch, masks
75
 
76
-
77
  def get_heatmap(image_url, text, pixel_size=10, iterations=3):
78
  tokenizer = get_tokenizer()
79
  model = get_model()
@@ -142,7 +142,7 @@ def app():
142
  col1, col2 = st.beta_columns([3, 1])
143
 
144
  with col2:
145
- pixel_size = st.selectbox("Pixel Size", options=range(15, 26, 5), index=1)
146
 
147
  iterations = st.selectbox("Refinement Steps", options=range(3, 30, 3), index=0)
148
 
 
73
 
74
  return image_batch, masks
75
 
76
+ @st.cache
77
  def get_heatmap(image_url, text, pixel_size=10, iterations=3):
78
  tokenizer = get_tokenizer()
79
  model = get_model()
 
142
  col1, col2 = st.beta_columns([3, 1])
143
 
144
  with col2:
145
+ pixel_size = st.selectbox("Pixel Size", options=range(10, 26, 5), index=2)
146
 
147
  iterations = st.selectbox("Refinement Steps", options=range(3, 30, 3), index=0)
148