loubnabnl HF staff commited on
Commit
5740d40
1 Parent(s): 76df626

update titles

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -21,16 +21,16 @@ def load_examples():
21
  examples = json.load(f)
22
  return examples
23
 
24
- st.set_page_config(page_icon=':laptop:', layout="wide")
25
 
26
 
27
  st.sidebar.header("Models")
28
  models = ["CodeParrot", "InCoder"]
29
- selected_models = st.sidebar.multiselect('Select code generation models to compare:', models, default=["CodeParrot"])
30
 
31
  st.sidebar.header("Tasks")
32
  tasks = [" ", "Pretraining datasets", "Model architecture", "Model evaluation", "Code generation"]
33
- selected_task = st.sidebar.selectbox("Select a task:", tasks)
34
 
35
 
36
  if selected_task == " ":
@@ -47,7 +47,7 @@ elif selected_task == "Pretraining datasets":
47
  for model in selected_models:
48
  with open(f"datasets/{model.lower()}.txt", "r") as f:
49
  text = f.read()
50
- st.markdown(f"### {model}:")
51
  st.markdown(text)
52
 
53
  elif selected_task == "Model architecture":
@@ -55,7 +55,7 @@ elif selected_task == "Model architecture":
55
  for model in selected_models:
56
  with open(f"architectures/{model.lower()}.txt", "r") as f:
57
  text = f.read()
58
- st.markdown(f"## {model}:")
59
  st.markdown(text)
60
 
61
  elif selected_task == "Model evaluation":
@@ -70,7 +70,7 @@ elif selected_task == "Code generation":
70
  examples = load_examples()
71
  example_names = [example["name"] for example in examples]
72
  name2id = dict([(name, i) for i, name in enumerate(example_names)])
73
- selected_example = st.sidebar.selectbox("Select one of the following examples:", example_names)
74
  example_text = examples[name2id[selected_example]]["value"]
75
  default_length = examples[name2id[selected_example]]["length"]
76
  st.sidebar.header("Generation settings")
@@ -84,5 +84,5 @@ elif selected_task == "Code generation":
84
  url = f'https://hf.space/embed/loubnabnl/{model.lower()}-subspace/+/api/predict/'
85
  r = requests.post(url=url, json={"data": [gen_prompt, max_new_tokens, temperature, seed]})
86
  generated_text = r.json()['data'][0]
87
- st.markdown(f"{model}:")
88
  st.code(generated_text)
 
21
  examples = json.load(f)
22
  return examples
23
 
24
+ st.set_page_config(page_icon=":laptop:", layout="wide")
25
 
26
 
27
  st.sidebar.header("Models")
28
  models = ["CodeParrot", "InCoder"]
29
+ selected_models = st.sidebar.multiselect("Select code generation models to compare", models, default=["CodeParrot"])
30
 
31
  st.sidebar.header("Tasks")
32
  tasks = [" ", "Pretraining datasets", "Model architecture", "Model evaluation", "Code generation"]
33
+ selected_task = st.sidebar.selectbox("Select a task", tasks)
34
 
35
 
36
  if selected_task == " ":
 
47
  for model in selected_models:
48
  with open(f"datasets/{model.lower()}.txt", "r") as f:
49
  text = f.read()
50
+ st.markdown(f"### {model}")
51
  st.markdown(text)
52
 
53
  elif selected_task == "Model architecture":
 
55
  for model in selected_models:
56
  with open(f"architectures/{model.lower()}.txt", "r") as f:
57
  text = f.read()
58
+ st.markdown(f"## {model}")
59
  st.markdown(text)
60
 
61
  elif selected_task == "Model evaluation":
 
70
  examples = load_examples()
71
  example_names = [example["name"] for example in examples]
72
  name2id = dict([(name, i) for i, name in enumerate(example_names)])
73
+ selected_example = st.sidebar.selectbox("Select one of the following examples", example_names)
74
  example_text = examples[name2id[selected_example]]["value"]
75
  default_length = examples[name2id[selected_example]]["length"]
76
  st.sidebar.header("Generation settings")
 
84
  url = f'https://hf.space/embed/loubnabnl/{model.lower()}-subspace/+/api/predict/'
85
  r = requests.post(url=url, json={"data": [gen_prompt, max_new_tokens, temperature, seed]})
86
  generated_text = r.json()['data'][0]
87
+ st.markdown(f"{model}")
88
  st.code(generated_text)