update
Browse files
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 |
-
|
| 50 |
"Select a code generation model", MODELS, key=1
|
| 51 |
)
|
| 52 |
-
with open(f"datasets/{
|
| 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 |
-
|
| 61 |
"Select a code generation model", MODELS, key=2
|
| 62 |
)
|
| 63 |
-
with open(f"architectures/{
|
| 64 |
text = f.read()
|
| 65 |
st.markdown(text)
|
| 66 |
-
if
|
| 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 |
-
|
| 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,
|
| 121 |
for i in range(len(output)):
|
| 122 |
-
st.markdown(f"**{
|
| 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])
|