loubnabnl HF staff commited on
Commit
58551fa
β€’
1 Parent(s): b3036ef
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -30,7 +30,7 @@ def generate_code(model_name, gen_prompt, max_new_tokens, temperature, seed):
30
  return generated_text
31
 
32
 
33
- st.set_page_config(page_icon=":laptop:", layout="wide")
34
 
35
  # Introduction
36
  st.title("Code generation with πŸ€—")
@@ -46,10 +46,10 @@ st.markdown(
46
  df = pd.read_csv("utils/data_preview.csv")
47
  st.dataframe(df)
48
  st.header("Model")
49
- selected_model1 = st.selectbox(
50
  "Select a code generation model", MODELS, key=1
51
  )
52
- with open(f"datasets/{selected_model1.lower()}.txt", "r") as f:
53
  text = f.read()
54
  st.markdown(text)
55
 
@@ -57,13 +57,13 @@ st.markdown(text)
57
  st.title("2 - Model architecture")
58
  st.markdown("Most code generation models use GPT style architectures trained on code. Some use encoder-decoder architectures such as AlphaCode.")
59
  st.header("Model")
60
- selected_model2 = st.selectbox(
61
  "Select a code generation model", MODELS, key=2
62
  )
63
- with open(f"architectures/{selected_model2.lower()}.txt", "r") as f:
64
  text = f.read()
65
  st.markdown(text)
66
- if model == "InCoder":
67
  st.image(INCODER_IMG, caption="Figure 1: InCoder training", width=700)
68
 
69
  # Model evaluation
@@ -75,7 +75,7 @@ st.markdown(intro)
75
  # Code generation
76
  st.title("4 - Code generation πŸ’»")
77
  st.header("Models")
78
- selected_models3 = st.sidebar.multiselect(
79
  "Select code generation models to compare", MODELS, default=["CodeParrot"], key=3
80
  )
81
  st.header("Examples")
@@ -117,7 +117,7 @@ if st.button("Generate code!"):
117
  temperature=temperature,
118
  seed=seed,
119
  )
120
- output = pool.map(generate_parallel, selected_models3)
121
  for i in range(len(output)):
122
- st.markdown(f"**{selected_models3[i]}**")
123
  st.code(output[i])
 
30
  return generated_text
31
 
32
 
33
+ #st.set_page_config(page_icon=":laptop:", layout="wide")
34
 
35
  # Introduction
36
  st.title("Code generation with πŸ€—")
 
46
  df = pd.read_csv("utils/data_preview.csv")
47
  st.dataframe(df)
48
  st.header("Model")
49
+ selected_model = st.selectbox(
50
  "Select a code generation model", MODELS, key=1
51
  )
52
+ with open(f"datasets/{selected_model.lower()}.txt", "r") as f:
53
  text = f.read()
54
  st.markdown(text)
55
 
 
57
  st.title("2 - Model architecture")
58
  st.markdown("Most code generation models use GPT style architectures trained on code. Some use encoder-decoder architectures such as AlphaCode.")
59
  st.header("Model")
60
+ selected_model = st.selectbox(
61
  "Select a code generation model", MODELS, key=2
62
  )
63
+ with open(f"architectures/{selected_model.lower()}.txt", "r") as f:
64
  text = f.read()
65
  st.markdown(text)
66
+ if selected_model == "InCoder":
67
  st.image(INCODER_IMG, caption="Figure 1: InCoder training", width=700)
68
 
69
  # Model evaluation
 
75
  # Code generation
76
  st.title("4 - Code generation πŸ’»")
77
  st.header("Models")
78
+ selected_models = st.multiselect(
79
  "Select code generation models to compare", MODELS, default=["CodeParrot"], key=3
80
  )
81
  st.header("Examples")
 
117
  temperature=temperature,
118
  seed=seed,
119
  )
120
+ output = pool.map(generate_parallel, selected_models)
121
  for i in range(len(output)):
122
+ st.markdown(f"**{selected_models[i]}**")
123
  st.code(output[i])