Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,27 +8,16 @@ import torch
|
|
8 |
from transformers import AutoTokenizer, CLIPTextModelWithProjection
|
9 |
|
10 |
|
11 |
-
DATA_PATH = '
|
12 |
|
13 |
-
ft_visual_features_file = DATA_PATH + '/
|
14 |
-
binary_visual_features_file = DATA_PATH + '/
|
15 |
ft_visual_features_database = np.load(ft_visual_features_file)
|
16 |
binary_visual_features = np.load(binary_visual_features_file)
|
17 |
|
18 |
database_csv_path = os.path.join(DATA_PATH, 'dataset_v1.csv')
|
19 |
database_df = pd.read_csv(database_csv_path)
|
20 |
|
21 |
-
#Gradio can display URL
|
22 |
-
def display_videos(display_df):
|
23 |
-
display_path_list = display_df['contentUrl'].to_list()
|
24 |
-
|
25 |
-
display_text_list = display_df['name'].to_list()
|
26 |
-
html = ''
|
27 |
-
for path, text in zip(display_path_list, display_text_list):
|
28 |
-
html_line = '<video autoplay loop {}> <source src="{}" type="video/mp4"> </video> <div class="caption">{}</div><br/>'.format("muted", path, text)
|
29 |
-
html += html_line
|
30 |
-
return display.HTML(html)
|
31 |
-
|
32 |
|
33 |
class NearestNeighbors:
|
34 |
"""
|
|
|
8 |
from transformers import AutoTokenizer, CLIPTextModelWithProjection
|
9 |
|
10 |
|
11 |
+
DATA_PATH = './data'
|
12 |
|
13 |
+
ft_visual_features_file = DATA_PATH + '/dataset_v1_visual_features_database.npy'
|
14 |
+
binary_visual_features_file = DATA_PATH + '/dataset_v1_visual_features_database_packed.npy'
|
15 |
ft_visual_features_database = np.load(ft_visual_features_file)
|
16 |
binary_visual_features = np.load(binary_visual_features_file)
|
17 |
|
18 |
database_csv_path = os.path.join(DATA_PATH, 'dataset_v1.csv')
|
19 |
database_df = pd.read_csv(database_csv_path)
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
class NearestNeighbors:
|
23 |
"""
|