firagne commited on
Commit
90f97b8
1 Parent(s): caaafd2

fix missing files in meta

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -30,7 +30,8 @@ python_path = hf_hub_download(
30
  sys.path.append(os.environ["PRIVATE_DIR"])
31
  from models import *
32
 
33
- max_results = 50
 
34
 
35
 
36
  def download_audio_(link):
@@ -82,16 +83,19 @@ def process(file_name, embed_html_all):
82
 
83
  tops = get_topN(I, ind_filenames, url_dict, catalog, max_results)
84
  formated = []
85
- for i in range(max_results):
86
- file = os.path.splitext(os.path.basename(ind_filenames[I[0][0]]))[0]
87
- formated.append(file)
88
- formated.append(tops[i])
89
-
90
  output_csv = f"{file_name}_results.csv"
91
  with open(output_csv, "w") as w:
92
  writer = csv.writer(w)
93
  for top in tops:
94
- file = os.path.basename(top)
 
 
 
 
 
 
 
 
95
  writer.writerow(dict_catalog[file].values())
96
 
97
  return (embed_html_all, output_csv, *formated)
 
30
  sys.path.append(os.environ["PRIVATE_DIR"])
31
  from models import *
32
 
33
+ max_results = 100
34
+ max_output = 50
35
 
36
 
37
  def download_audio_(link):
 
83
 
84
  tops = get_topN(I, ind_filenames, url_dict, catalog, max_results)
85
  formated = []
 
 
 
 
 
86
  output_csv = f"{file_name}_results.csv"
87
  with open(output_csv, "w") as w:
88
  writer = csv.writer(w)
89
  for top in tops:
90
+ if len(formated) / 2 >= max_output:
91
+ break
92
+
93
+ file = os.path.splitext(os.path.basename(top))[0]
94
+ if file not in dict_catalog:
95
+ continue
96
+
97
+ formated.append(file)
98
+ formated.append(top)
99
  writer.writerow(dict_catalog[file].values())
100
 
101
  return (embed_html_all, output_csv, *formated)