SaulLu commited on
Commit
51628e8
1 Parent(s): 7562221

chose by checkpoint

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -30,18 +30,27 @@ def generation_markup_format(text):
30
  ds = load_dataset("bigscience/bloom-generations", use_auth_token=HF_API_TOKEN)
31
  ds = ds["train"]
32
 
33
- possible_langs = ds.unique("lang")
34
 
35
  col_1, col_2 = st.columns(2)
36
  with col_1:
 
37
  st.markdown("<h1 style='text-align: center'>Prompt</h1>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
38
  chosen_lang = st.selectbox("Choose a lang", possible_langs + ["all"])
39
  if chosen_lang == "all":
40
- ds_lang = ds
41
  else:
42
- ds_lang = ds.filter(
43
- lambda exs: [lang == chosen_lang for lang in exs["lang"]], batched=True
44
- )
 
45
  possible_prompts = ds_lang.unique("prompt")
46
  chosen_prompt = st.selectbox("Choose a prompt", possible_prompts)
47
  st.markdown(safe_text(chosen_prompt), unsafe_allow_html=True)
 
30
  ds = load_dataset("bigscience/bloom-generations", use_auth_token=HF_API_TOKEN)
31
  ds = ds["train"]
32
 
 
33
 
34
  col_1, col_2 = st.columns(2)
35
  with col_1:
36
+ possible_checkpoint = ds.unique("checkpoint")
37
  st.markdown("<h1 style='text-align: center'>Prompt</h1>", unsafe_allow_html=True)
38
+ chosen_checkpoint = st.selectbox("Choose a checkpoint", possible_checkpoint + ["all"])
39
+ if chosen_checkpoint == "all":
40
+ ds_ckp = ds
41
+ else:
42
+ ds_ckp = ds.filter(
43
+ lambda exs: [lang == chosen_checkpoint for lang in exs["checkpoint"]], batched=True
44
+ )
45
+ possible_langs = ds.unique("lang")
46
  chosen_lang = st.selectbox("Choose a lang", possible_langs + ["all"])
47
  if chosen_lang == "all":
48
+ ds_lang = ds_ckp
49
  else:
50
+ ds_lang = ds_ckp.filter(
51
+ lambda exs: [lang == chosen_lang for lang in exs["lang"]], batched=True
52
+ )
53
+
54
  possible_prompts = ds_lang.unique("prompt")
55
  chosen_prompt = st.selectbox("Choose a prompt", possible_prompts)
56
  st.markdown(safe_text(chosen_prompt), unsafe_allow_html=True)