Anisha Bhatnagar commited on
Commit
884a75c
Β·
1 Parent(s): 88f39f5

added gram2vec cahcing url and download command; updated HRS data to reddit data on the UI; made wegmann model the default one;

Browse files
Files changed (3) hide show
  1. app.py +5 -4
  2. config/config.yaml +3 -0
  3. utils/ui.py +2 -2
app.py CHANGED
@@ -29,6 +29,7 @@ cfg = load_config()
29
  download_file_override(cfg.get('background_authors_df_url'), cfg.get('background_authors_df_path'))
30
  download_file_override(cfg.get('instances_to_explain_url'), cfg.get('instances_to_explain_path'))
31
  download_file_override(cfg.get('gram2vec_feats_url'), cfg.get('gram2vec_feats_path'))
 
32
  download_file_override(cfg.get('embeddings_cache_url'), cfg.get('embeddings_cache_path'))
33
  download_file_override(cfg.get('zoom_cache_url'), cfg.get('zoom_cache_path'))
34
  download_file_override(cfg.get('region_cache_url'), cfg.get('region_cache_path'))
@@ -142,13 +143,13 @@ def app(share=False):
142
  # ── Model Selection ─────────────────────────────────
143
  model_radio = gr.Radio(
144
  choices=[
 
145
  'gabrielloiseau/LUAR-MUD-sentence-transformers',
146
  'gabrielloiseau/LUAR-CRUD-sentence-transformers',
147
  'miladalsh/light-luar',
148
- 'AnnaWegmann/Style-Embedding',
149
  'Other'
150
  ],
151
- value='gabrielloiseau/LUAR-MUD-sentence-transformers',
152
  label='Choose a Model to inspect'
153
  )
154
  print(f"Model choices: {model_radio.choices}")
@@ -168,8 +169,8 @@ def app(share=False):
168
 
169
  # ── Task Source Selection ─────────────────────────────────
170
  task_mode = gr.Radio(
171
- choices=["Predefined HRS Task", "Upload Your Own Task"],
172
- value="Predefined HRS Task",
173
  label="Select Task Source"
174
  )
175
 
 
29
  download_file_override(cfg.get('background_authors_df_url'), cfg.get('background_authors_df_path'))
30
  download_file_override(cfg.get('instances_to_explain_url'), cfg.get('instances_to_explain_path'))
31
  download_file_override(cfg.get('gram2vec_feats_url'), cfg.get('gram2vec_feats_path'))
32
+ download_file_override(cfg.get('gram2vec_cache_url'), cfg.get('gram2vec_cache_path'))
33
  download_file_override(cfg.get('embeddings_cache_url'), cfg.get('embeddings_cache_path'))
34
  download_file_override(cfg.get('zoom_cache_url'), cfg.get('zoom_cache_path'))
35
  download_file_override(cfg.get('region_cache_url'), cfg.get('region_cache_path'))
 
143
  # ── Model Selection ─────────────────────────────────
144
  model_radio = gr.Radio(
145
  choices=[
146
+ 'AnnaWegmann/Style-Embedding',
147
  'gabrielloiseau/LUAR-MUD-sentence-transformers',
148
  'gabrielloiseau/LUAR-CRUD-sentence-transformers',
149
  'miladalsh/light-luar',
 
150
  'Other'
151
  ],
152
+ value='AnnaWegmann/Style-Embedding',
153
  label='Choose a Model to inspect'
154
  )
155
  print(f"Model choices: {model_radio.choices}")
 
169
 
170
  # ── Task Source Selection ─────────────────────────────────
171
  task_mode = gr.Radio(
172
+ choices=["Predefined Reddit Task", "Upload Your Own Task"],
173
+ value="Predefined Reddit Task",
174
  label="Select Task Source"
175
  )
176
 
config/config.yaml CHANGED
@@ -9,6 +9,9 @@ background_authors_df_url: "https://huggingface.co/datasets/miladalsh/explana
9
  gram2vec_feats_path: "./datasets/gram2vec_feats.csv"
10
  gram2vec_feats_url: "https://huggingface.co/datasets/miladalsh/explanation_tool_files/resolve/main/gram2vec_feats.csv?download=true"
11
 
 
 
 
12
  embeddings_cache_url: "https://huggingface.co/datasets/miladalsh/explanation_tool_files/resolve/main/embeddings_cache.zip?download=true"
13
  embeddings_cache_path: "./datasets/embeddings_cache/"
14
 
 
9
  gram2vec_feats_path: "./datasets/gram2vec_feats.csv"
10
  gram2vec_feats_url: "https://huggingface.co/datasets/miladalsh/explanation_tool_files/resolve/main/gram2vec_feats.csv?download=true"
11
 
12
+ gram2vec_cache_url: "https://huggingface.co/datasets/miladalsh/explanation_tool_files/resolve/main/gram2vec_cache.zip?download=true"
13
+ gram2vec_cache_path: "./datasets/gram2vec_cache/"
14
+
15
  embeddings_cache_url: "https://huggingface.co/datasets/miladalsh/explanation_tool_files/resolve/main/embeddings_cache.zip?download=true"
16
  embeddings_cache_path: "./datasets/embeddings_cache/"
17
 
utils/ui.py CHANGED
@@ -81,14 +81,14 @@ def read_txt(f):
81
  def toggle_task(mode):
82
  print(mode)
83
  return (
84
- gr.update(visible=(mode == "Predefined HRS Task")),
85
  gr.update(visible=(mode == "Upload Your Own Task"))
86
  )
87
 
88
  # Update displayed texts based on mode
89
  def update_task_display(mode, iid, instances, background_df, mystery_file, cand1_file, cand2_file, cand3_file, true_author, model_radio, custom_model_input):
90
  model_name = model_radio if model_radio != "Other" else custom_model_input
91
- if mode == "Predefined HRS Task":
92
  iid = int(iid.replace('Task ', ''))
93
  data = instances[iid]
94
  ground_truth_author = 100#data['gt_idx']
 
81
  def toggle_task(mode):
82
  print(mode)
83
  return (
84
+ gr.update(visible=(mode == "Predefined Reddit Task")),
85
  gr.update(visible=(mode == "Upload Your Own Task"))
86
  )
87
 
88
  # Update displayed texts based on mode
89
  def update_task_display(mode, iid, instances, background_df, mystery_file, cand1_file, cand2_file, cand3_file, true_author, model_radio, custom_model_input):
90
  model_name = model_radio if model_radio != "Other" else custom_model_input
91
+ if mode == "Predefined Reddit Task":
92
  iid = int(iid.replace('Task ', ''))
93
  data = instances[iid]
94
  ground_truth_author = 100#data['gt_idx']