sayakpaul HF staff commited on
Commit
1098b62
1 Parent(s): d99333a

add: examples.

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -37,18 +37,16 @@ def query(image, top_k):
37
  labels = []
38
 
39
  candidates = []
40
- overlaps = []
41
 
42
  for idx, r in enumerate(sorted(results, key=results.get, reverse=True)):
43
  if idx == top_k:
44
  break
45
  image_id, label = r.split("_")[0], r.split("_")[1]
46
  candidates.append(candidate_dataset[int(image_id)]["image"])
47
- labels.append(label)
48
- overlaps.append(results[r])
49
 
50
  candidates.insert(0, image)
51
- labels.insert(0, label)
52
 
53
  for i, candidate in enumerate(candidates):
54
  filename = f"{i}.png"
@@ -66,4 +64,6 @@ gr.Interface(
66
  query,
67
  inputs=[gr.Image(), gr.Slider(value=5, minimum=1, maximum=10, step=1)],
68
  outputs=gr.Gallery(),
 
 
69
  ).launch()
 
37
  labels = []
38
 
39
  candidates = []
 
40
 
41
  for idx, r in enumerate(sorted(results, key=results.get, reverse=True)):
42
  if idx == top_k:
43
  break
44
  image_id, label = r.split("_")[0], r.split("_")[1]
45
  candidates.append(candidate_dataset[int(image_id)]["image"])
46
+ labels.append(f"Label: {label}")
 
47
 
48
  candidates.insert(0, image)
49
+ labels.insert(0, "Query Image")
50
 
51
  for i, candidate in enumerate(candidates):
52
  filename = f"{i}.png"
 
64
  query,
65
  inputs=[gr.Image(), gr.Slider(value=5, minimum=1, maximum=10, step=1)],
66
  outputs=gr.Gallery(),
67
+ # Filenames denote the integer labels. Know here: https://hf.co/datasets/beans
68
+ examples=[["0.png"], ["1.png"], ["2.png"]],
69
  ).launch()