Spaces:
Build error
Build error
aswin-raghavan commited on
Commit ·
c159a9f
1
Parent(s): 51d1628
image embedding to the right
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ def update_table(img, df, state, label):
|
|
| 27 |
next_img = state[-1]
|
| 28 |
img_embeds = extract_features(img).detach().numpy().squeeze().tolist()
|
| 29 |
print(img_name, img.shape, len(img_embeds), 'images left:', len(state))
|
| 30 |
-
new_df = pd.DataFrame({'image_name': img_name, '
|
| 31 |
print(new_df)
|
| 32 |
new_df.at[0, 'image_embed'] = img_embeds
|
| 33 |
print(new_df)
|
|
@@ -46,10 +46,10 @@ with gr.Blocks(title="End-User Personalization") as demo:
|
|
| 46 |
# start_button = gr.Button(label="Start")
|
| 47 |
image_display = gr.Image()
|
| 48 |
# text_display = gr.Text()
|
| 49 |
-
with gr.
|
| 50 |
-
upvote = gr.Button("
|
| 51 |
-
downvote = gr.Button("
|
| 52 |
-
annotated_samples = gr.Dataframe(headers=['image_name', '
|
| 53 |
col_count=(3, 'fixed'), label='Annotations', wrap=True)
|
| 54 |
upvote.click(update_table_up, inputs=[image_display, annotated_samples, train_images], outputs=[image_display, annotated_samples, train_images])
|
| 55 |
downvote.click(update_table_down, inputs=[image_display, annotated_samples, train_images], outputs=[image_display,annotated_samples, train_images])
|
|
|
|
| 27 |
next_img = state[-1]
|
| 28 |
img_embeds = extract_features(img).detach().numpy().squeeze().tolist()
|
| 29 |
print(img_name, img.shape, len(img_embeds), 'images left:', len(state))
|
| 30 |
+
new_df = pd.DataFrame({'image_name': img_name, 'label': label, 'image_embed': None}, columns=['image_name', 'image_embed', 'label'], index=[0])
|
| 31 |
print(new_df)
|
| 32 |
new_df.at[0, 'image_embed'] = img_embeds
|
| 33 |
print(new_df)
|
|
|
|
| 46 |
# start_button = gr.Button(label="Start")
|
| 47 |
image_display = gr.Image()
|
| 48 |
# text_display = gr.Text()
|
| 49 |
+
with gr.Row():
|
| 50 |
+
upvote = gr.Button("👍")
|
| 51 |
+
downvote = gr.Button("👎")
|
| 52 |
+
annotated_samples = gr.Dataframe(headers=['image_name', 'label', 'image_embed'], row_count=(1, 'dynamic'),
|
| 53 |
col_count=(3, 'fixed'), label='Annotations', wrap=True)
|
| 54 |
upvote.click(update_table_up, inputs=[image_display, annotated_samples, train_images], outputs=[image_display, annotated_samples, train_images])
|
| 55 |
downvote.click(update_table_down, inputs=[image_display, annotated_samples, train_images], outputs=[image_display,annotated_samples, train_images])
|