bradley6597 commited on
Commit
196dcc8
1 Parent(s): c17eb1b

Add KS3 Filter

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -132,7 +132,7 @@ def search_index(search_text, sd, ks, sort_by, max_results, user_num, search_tit
132
 
133
  output_df['abstract'] = output_df['abstract'].str.lower()
134
  output_df['post_filepath'] = output_df['post_filepath'].str.lower()
135
- output_df['missing_desc'] = np.where(output_df['abstract'].str.contains('eyfs|ks1|ks2', regex = True), 0, 1)
136
  output_df2 = output_df[(output_df['abstract'].str.contains(keystage_filter, regex = True) | (output_df['missing_desc'] == 1))].copy()
137
  output_df2 = output_df2[(output_df2['post_filepath'].str.contains(keystage_filter, regex = True))]
138
  if output_df2.shape[0] == 0:
@@ -140,7 +140,7 @@ def search_index(search_text, sd, ks, sort_by, max_results, user_num, search_tit
140
  else:
141
  output_df['abstract'] = output_df['abstract'].str.lower()
142
  output_df['post_filepath'] = output_df['post_filepath'].str.lower()
143
- output_df['missing_desc'] = np.where(output_df['abstract'].str.contains('eyfs|ks1|ks2', regex = True), 0, 1)
144
  output_df2 = output_df
145
  output_df2['ind'] = output_df2.index
146
  min_parent_score = output_df2.groupby('parent_id')['ind'].min().reset_index()
@@ -280,7 +280,7 @@ with gr.Blocks(css=style) as app:
280
  title_search = gr.Checkbox(label = 'Search title only')
281
  # with gr.Row():
282
  shared_drive = gr.Dropdown(choices = ['Illustrations - 01-10 to 07-22', 'Illustrations - Now', 'Shutter Stock Images', 'Beyond - Illustrations', 'DO NOT USE IN GENERAL RESOURCES - South Africa', 'Australia - Rhino Readers Illustrations', 'Twinkl Art Gallery'], multiselect = True, label = 'Shared Drive', value = ['Illustrations - 01-10 to 07-22', 'Illustrations - Now'])
283
- key_stage = gr.Dropdown(choices = ['EYFS', 'KS1', 'KS2'], multiselect = True, label = 'Key Stage', value = ['EYFS', 'KS1', 'KS2'])
284
  image_type = gr.Dropdown(choices = ['JPEG', 'PNG', 'TIF'], multiselect = True, label = 'Image Type', value = ['PNG', 'JPEG', 'TIF'])
285
 
286
  sort_by = gr.Dropdown(choices = ['Relevance', 'Date Created', 'A-Z'], value = 'Relevance', multiselect = False, label = 'Sort By')
 
132
 
133
  output_df['abstract'] = output_df['abstract'].str.lower()
134
  output_df['post_filepath'] = output_df['post_filepath'].str.lower()
135
+ output_df['missing_desc'] = np.where(output_df['abstract'].str.contains('eyfs|ks1|ks2|ks3', regex = True), 0, 1)
136
  output_df2 = output_df[(output_df['abstract'].str.contains(keystage_filter, regex = True) | (output_df['missing_desc'] == 1))].copy()
137
  output_df2 = output_df2[(output_df2['post_filepath'].str.contains(keystage_filter, regex = True))]
138
  if output_df2.shape[0] == 0:
 
140
  else:
141
  output_df['abstract'] = output_df['abstract'].str.lower()
142
  output_df['post_filepath'] = output_df['post_filepath'].str.lower()
143
+ output_df['missing_desc'] = np.where(output_df['abstract'].str.contains('eyfs|ks1|ks2|ks3', regex = True), 0, 1)
144
  output_df2 = output_df
145
  output_df2['ind'] = output_df2.index
146
  min_parent_score = output_df2.groupby('parent_id')['ind'].min().reset_index()
 
280
  title_search = gr.Checkbox(label = 'Search title only')
281
  # with gr.Row():
282
  shared_drive = gr.Dropdown(choices = ['Illustrations - 01-10 to 07-22', 'Illustrations - Now', 'Shutter Stock Images', 'Beyond - Illustrations', 'DO NOT USE IN GENERAL RESOURCES - South Africa', 'Australia - Rhino Readers Illustrations', 'Twinkl Art Gallery'], multiselect = True, label = 'Shared Drive', value = ['Illustrations - 01-10 to 07-22', 'Illustrations - Now'])
283
+ key_stage = gr.Dropdown(choices = ['EYFS', 'KS1', 'KS2', 'KS3'], multiselect = True, label = 'Key Stage', value = ['EYFS', 'KS1', 'KS2', 'KS3'])
284
  image_type = gr.Dropdown(choices = ['JPEG', 'PNG', 'TIF'], multiselect = True, label = 'Image Type', value = ['PNG', 'JPEG', 'TIF'])
285
 
286
  sort_by = gr.Dropdown(choices = ['Relevance', 'Date Created', 'A-Z'], value = 'Relevance', multiselect = False, label = 'Sort By')