Samuel Schmidt commited on
Commit
676881e
·
1 Parent(s): 3e014f5
Files changed (1) hide show
  1. src/app.py +39 -4
src/app.py CHANGED
@@ -92,18 +92,53 @@ def get_neighbors(query_image, selected_descriptor, top_k=5):
92
  return []
93
 
94
 
 
 
 
95
  # Define the Gradio Interface
96
 
97
  with gr.Blocks() as demo:
98
- image_input = gr.Image(type="pil", label="Please upload an image")
 
 
 
 
 
 
 
 
 
 
 
99
  checkboxes_descr = gr.CheckboxGroup(["Color Descriptor", "LBP", "CLIP"], label="Please choose an descriptor")
100
 
101
  btn = gr.Button(value="Submit")
102
- gallery_output = gr.Gallery()
 
 
 
 
 
 
 
 
 
 
 
 
103
  btn.click(get_neighbors, inputs=[image_input, checkboxes_descr], outputs=[gallery_output])
104
 
105
- btn_index = gr.Button(value="Re-index Dataset")
106
- btn_index.click(index_dataset)
 
 
 
 
 
 
 
 
 
107
 
108
  if __name__ == "__main__":
109
  demo.launch()
 
92
  return []
93
 
94
 
95
+ def load_cbir_dataset(datasetname, size):
96
+ pass
97
+
98
  # Define the Gradio Interface
99
 
100
  with gr.Blocks() as demo:
101
+ gr.Markdown("""
102
+ # Welcome to this CBIR app
103
+
104
+ This is a CBIR app focused on the retrieval of similar faces.
105
+
106
+ ## Find similar images
107
+ Here you can upload an image, that is compared with existing image in our dataset.
108
+ """)
109
+ with gr.Row():
110
+ image_input = gr.Image(type="pil", label="Please upload your image")
111
+ gallery_output = gr.Gallery()
112
+
113
  checkboxes_descr = gr.CheckboxGroup(["Color Descriptor", "LBP", "CLIP"], label="Please choose an descriptor")
114
 
115
  btn = gr.Button(value="Submit")
116
+ gr.Markdown("""
117
+ ## Settings
118
+ Here you can adjust how your image is compared
119
+ """)
120
+
121
+ with gr.Row():
122
+ checkboxes_descr = gr.CheckboxGroup(["Color Descriptor", "LBP", "CLIP"], label="Please choose an descriptor")
123
+ dataset_dropdown = gr.Dropdown(
124
+ ["huggan/CelebA-faces", "EIT/cbir-eit"],
125
+ value=["huggan/CelebA-faces"]
126
+ )
127
+ btn_index = gr.Button(value="Switch Dataset")
128
+ btn_index.click(load_cbir_dataset, inputs=[dataset_dropdown, 100], outputs=[dataset_with_embeddings])
129
  btn.click(get_neighbors, inputs=[image_input, checkboxes_descr], outputs=[gallery_output])
130
 
131
+ # gr.Markdown(
132
+ # """
133
+ # ## Upload your own data to the CBIR
134
+ # WARNING! Please be aware, that what you are uploading here, will be public to anyone.
135
+ # Don't upload images for which you don't have the rights to do so.
136
+ # """)
137
+
138
+ # file_output = gr.File()
139
+ # upload_button = gr.UploadButton("Click to upload a file", file_types=["image"], file_count="multiple")
140
+ # upload_button.upload(upload_file, upload_button, file_output)
141
+
142
 
143
  if __name__ == "__main__":
144
  demo.launch()