Spaces:
Build error
Build error
aswin-raghavan commited on
Commit ·
7d90c27
1
Parent(s): 6a38f13
shuffle glob
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from PIL import Image
|
|
| 6 |
from transformers import CLIPProcessor, CLIPModel
|
| 7 |
import pandas as pd
|
| 8 |
from glob import glob
|
| 9 |
-
from random import choice
|
| 10 |
|
| 11 |
clip_model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
|
| 12 |
clip_processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
|
|
@@ -49,7 +49,8 @@ def get_random_image(state):
|
|
| 49 |
|
| 50 |
|
| 51 |
with gr.Blocks(title="End-User Personalization") as demo:
|
| 52 |
-
|
|
|
|
| 53 |
# start_button = gr.Button(label="Start")
|
| 54 |
image_display = gr.Image()
|
| 55 |
image_fname = gr.Textbox()
|
|
@@ -58,7 +59,7 @@ with gr.Blocks(title="End-User Personalization") as demo:
|
|
| 58 |
upvote = gr.Button("👍")
|
| 59 |
downvote = gr.Button("👎")
|
| 60 |
annotated_samples = gr.Dataframe(headers=['image_name', 'label', 'image_embed'], row_count=(1, 'dynamic'),
|
| 61 |
-
col_count=(3, 'fixed'), label='Annotations', wrap=
|
| 62 |
upvote.click(update_table_up, inputs=[image_display, image_fname, annotated_samples, images], outputs=[image_display, image_fname, annotated_samples, images])
|
| 63 |
downvote.click(update_table_down, inputs=[image_display, image_fname, annotated_samples, images], outputs=[image_display, image_fname, annotated_samples, images])
|
| 64 |
# examples = gr.Examples(examples=[["dog.jpg"], ["colombia.jpg"], ["germany.jpg"]], inputs=[image_display])
|
|
|
|
| 6 |
from transformers import CLIPProcessor, CLIPModel
|
| 7 |
import pandas as pd
|
| 8 |
from glob import glob
|
| 9 |
+
from random import choice, shuffle
|
| 10 |
|
| 11 |
clip_model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
|
| 12 |
clip_processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
with gr.Blocks(title="End-User Personalization") as demo:
|
| 52 |
+
img_list = shuffle(glob('images/**/*.jpg'))
|
| 53 |
+
images = gr.State()
|
| 54 |
# start_button = gr.Button(label="Start")
|
| 55 |
image_display = gr.Image()
|
| 56 |
image_fname = gr.Textbox()
|
|
|
|
| 59 |
upvote = gr.Button("👍")
|
| 60 |
downvote = gr.Button("👎")
|
| 61 |
annotated_samples = gr.Dataframe(headers=['image_name', 'label', 'image_embed'], row_count=(1, 'dynamic'),
|
| 62 |
+
col_count=(3, 'fixed'), label='Annotations', wrap=False)
|
| 63 |
upvote.click(update_table_up, inputs=[image_display, image_fname, annotated_samples, images], outputs=[image_display, image_fname, annotated_samples, images])
|
| 64 |
downvote.click(update_table_down, inputs=[image_display, image_fname, annotated_samples, images], outputs=[image_display, image_fname, annotated_samples, images])
|
| 65 |
# examples = gr.Examples(examples=[["dog.jpg"], ["colombia.jpg"], ["germany.jpg"]], inputs=[image_display])
|