loubnabnl HF staff commited on
Commit
06d2b63
1 Parent(s): 12798fb
Files changed (1) hide show
  1. app.py +21 -21
app.py CHANGED
@@ -93,6 +93,7 @@ with col1:
93
  )
94
  example_text = examples[name2id[selected_example]]["value"]
95
  default_length = examples[name2id[selected_example]]["length"]
 
96
  st.subheader("Generation settings")
97
  temperature = st.slider(
98
  "Temperature:", value=0.2, min_value=0.0, step=0.1, max_value=2.0
@@ -107,24 +108,23 @@ with col1:
107
  seed = st.slider(
108
  "Random seed:", value=42, min_value=0, step=1, max_value=1000
109
  )
110
- with col2:
111
- gen_prompt = st.text_area(
112
- "Generate code with prompt:",
113
- value=example_text,
114
- height=220,
115
- ).strip()
116
- if st.button("Generate code!"):
117
- with st.spinner("Generating code..."):
118
- # Create a multiprocessing Pool
119
- pool = Pool()
120
- generate_parallel = partial(
121
- generate_code,
122
- gen_prompt=gen_prompt,
123
- max_new_tokens=max_new_tokens,
124
- temperature=temperature,
125
- seed=seed,
126
- )
127
- output = pool.map(generate_parallel, selected_models)
128
- for i in range(len(output)):
129
- st.markdown(f"**{selected_models[i]}**")
130
- st.code(output[i])
 
93
  )
94
  example_text = examples[name2id[selected_example]]["value"]
95
  default_length = examples[name2id[selected_example]]["length"]
96
+ with col2:
97
  st.subheader("Generation settings")
98
  temperature = st.slider(
99
  "Temperature:", value=0.2, min_value=0.0, step=0.1, max_value=2.0
 
108
  seed = st.slider(
109
  "Random seed:", value=42, min_value=0, step=1, max_value=1000
110
  )
111
+ gen_prompt = st.text_area(
112
+ "Generate code with prompt:",
113
+ value=example_text,
114
+ height=220,
115
+ ).strip()
116
+ if st.button("Generate code!"):
117
+ with st.spinner("Generating code..."):
118
+ # Create a multiprocessing Pool
119
+ pool = Pool()
120
+ generate_parallel = partial(
121
+ generate_code,
122
+ gen_prompt=gen_prompt,
123
+ max_new_tokens=max_new_tokens,
124
+ temperature=temperature,
125
+ seed=seed,
126
+ )
127
+ output = pool.map(generate_parallel, selected_models)
128
+ for i in range(len(output)):
129
+ st.markdown(f"**{selected_models[i]}**")
130
+ st.code(output[i])