aswin-raghavan commited on
Commit
7de49b3
·
1 Parent(s): ba627dd

bugfix: list no shape

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -24,7 +24,7 @@ def update_table(img, df, state, label):
24
  img_name = state.pop()
25
  next_img = state[-1]
26
  img_embeds = extract_features(img).detach().numpy().squeeze().tolist()
27
- print(img_name, img.shape, img_embeds.shape, 'images left:', len(state))
28
  new_df = pd.DataFrame({'image_name': img_name, 'image_embed': img_embeds, 'label': label}, columns=['image_name', 'image_embed', 'label'])
29
  print(new_df)
30
  df = pd.concat([df, new_df])
@@ -37,7 +37,7 @@ def update_table_down(img, df, state):
37
  return update_table(img, df, state, 0)
38
 
39
 
40
- with gr.Blocks() as demo:
41
  train_images = gr.State(["dog.jpg", "colombia.jpg", "germany.jpg"])
42
  # start_button = gr.Button(label="Start")
43
  image_display = gr.Image()
@@ -60,4 +60,4 @@ with gr.Blocks() as demo:
60
  # description="Add a picture and a list of labels separated by commas",
61
  # title="CLIP feature extractor")
62
  demo.load(lambda: train_images.value[-1], inputs=[], outputs=image_display)
63
- demo.launch(show_error=True, debug=True)
 
24
  img_name = state.pop()
25
  next_img = state[-1]
26
  img_embeds = extract_features(img).detach().numpy().squeeze().tolist()
27
+ print(img_name, img.shape, len(img_embeds), 'images left:', len(state))
28
  new_df = pd.DataFrame({'image_name': img_name, 'image_embed': img_embeds, 'label': label}, columns=['image_name', 'image_embed', 'label'])
29
  print(new_df)
30
  df = pd.concat([df, new_df])
 
37
  return update_table(img, df, state, 0)
38
 
39
 
40
+ with gr.Blocks(title="End-User Personalization") as demo:
41
  train_images = gr.State(["dog.jpg", "colombia.jpg", "germany.jpg"])
42
  # start_button = gr.Button(label="Start")
43
  image_display = gr.Image()
 
60
  # description="Add a picture and a list of labels separated by commas",
61
  # title="CLIP feature extractor")
62
  demo.load(lambda: train_images.value[-1], inputs=[], outputs=image_display)
63
+ demo.launch(show_error=True, debug=True, title)