Spaces:
Build error
Build error
Update helper.py
Browse files
helper.py
CHANGED
|
@@ -229,36 +229,3 @@ def get_images_with_bounding_boxes_from_s3(bucket_name, file_paths, bounding_box
|
|
| 229 |
st.image(img, caption=file_path, use_column_width=True)
|
| 230 |
|
| 231 |
|
| 232 |
-
def main():
|
| 233 |
-
print('Begin Main')
|
| 234 |
-
dataset_name = "WayveScenes"
|
| 235 |
-
query = "black car"
|
| 236 |
-
limit = 10
|
| 237 |
-
offset = 0
|
| 238 |
-
scoring_func = "cosine"
|
| 239 |
-
search_in_images = True
|
| 240 |
-
search_in_small_objects = True
|
| 241 |
-
dataset = load_dataset(f"quasara-io/{dataset_name}")
|
| 242 |
-
print('loaded dataset')
|
| 243 |
-
dataset_keys = dataset.keys()
|
| 244 |
-
random_sample_size = 1000
|
| 245 |
-
main_df, split_df = parallel_load_and_combine(dataset_keys, dataset, n_rows=random_sample_size)
|
| 246 |
-
#Now we get the coordinates and the stuff
|
| 247 |
-
print('processed datasets')
|
| 248 |
-
if search_in_small_objects:
|
| 249 |
-
results = batch_search(query, split_df)
|
| 250 |
-
print(results)
|
| 251 |
-
top_k_paths = get_file_paths(split_df,results)
|
| 252 |
-
top_k_cordinates = get_cordinates(split_df, results)
|
| 253 |
-
print(top_k_paths)
|
| 254 |
-
print(top_k_cordinates)
|
| 255 |
-
return top_k_paths, top_k_cordinates
|
| 256 |
-
else:
|
| 257 |
-
results = search(query, main_df, limit, offset, scoring_func, search_in_images)
|
| 258 |
-
top_k_paths = get_file_paths(main_df,results)
|
| 259 |
-
print(top_k_paths)
|
| 260 |
-
return top_k_paths
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
if __name__ == "__main__":
|
| 264 |
-
main()
|
|
|
|
| 229 |
st.image(img, caption=file_path, use_column_width=True)
|
| 230 |
|
| 231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|