YannisK commited on
Commit
acff6dc
1 Parent(s): c1911e8
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -134,16 +134,20 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50, sf_ids='
134
 
135
  # which sf
136
  sf_idx_ = [55, 14, 5, 4, 52, 57, 40, 9]
 
 
137
  if sf_ids.lower().startswith('r'):
 
138
  n_sf_ids = int(sf_ids[1:])
139
  sf_idx_ = np.random.randint(256, size=n_sf_ids)
140
  elif sf_ids != '':
141
  sf_idx_ = map(int, sf_ids.strip().split(','))
142
 
143
  if only_matching:
144
- sf_idx_ = [i for i in sf_idx_ if i in list(ind_match)]
145
-
146
-
 
147
 
148
 
149
 
@@ -269,7 +273,7 @@ iface = gr.Interface(
269
  css=css,
270
  examples=[
271
  ["chateau_1.png", "chateau_2.png", 2, 100, '55,14,5,4,52,57,40,9', True],
272
- ["anafi1.jpeg", "anafi2.jpeg", 4, 50, '99,100,142,213,236', True],
273
  ["areopoli1.jpeg", "areopoli2.jpeg", 4, 50, '72,44,142,213,236', True],
274
  ]
275
  )
 
134
 
135
  # which sf
136
  sf_idx_ = [55, 14, 5, 4, 52, 57, 40, 9]
137
+ random_mode = False
138
+ n_sf_ids = 0
139
  if sf_ids.lower().startswith('r'):
140
+ random_mode = True
141
  n_sf_ids = int(sf_ids[1:])
142
  sf_idx_ = np.random.randint(256, size=n_sf_ids)
143
  elif sf_ids != '':
144
  sf_idx_ = map(int, sf_ids.strip().split(','))
145
 
146
  if only_matching:
147
+ if random_mode:
148
+ sf_idx_ = ind_match[np.random.randint(len(list(ind_match)), size=n_sf_ids)]
149
+ else:
150
+ sf_idx_ = [i for i in sf_idx_ if i in list(ind_match)]
151
 
152
 
153
 
 
273
  css=css,
274
  examples=[
275
  ["chateau_1.png", "chateau_2.png", 2, 100, '55,14,5,4,52,57,40,9', True],
276
+ ["anafi1.jpeg", "anafi2.jpeg", 4, 150, '51,99,100,142,213,236', True],
277
  ["areopoli1.jpeg", "areopoli2.jpeg", 4, 50, '72,44,142,213,236', True],
278
  ]
279
  )