Spaces:
Runtime error
Runtime error
Commit
·
dc9ee64
1
Parent(s):
baf7f9c
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,76 +78,14 @@ def generate_teaser(gen_prompt):
|
|
| 78 |
return generations[0]["CodeParrot"]
|
| 79 |
|
| 80 |
st.set_page_config(page_icon=":laptop:", layout="wide")
|
| 81 |
-
with open("utils/table_contents.md", "r") as f:
|
| 82 |
-
contents = f.read()
|
| 83 |
|
| 84 |
-
st.sidebar.markdown(contents)
|
| 85 |
|
| 86 |
# Introduction
|
| 87 |
-
st.title("
|
| 88 |
-
read_markdown("utils/summary.md")
|
| 89 |
-
## teaser
|
| 90 |
-
example_text = "def print_hello_world():"
|
| 91 |
-
col1, col2, col3 = st.columns([1, 2, 1])
|
| 92 |
-
with col2:
|
| 93 |
-
gen_prompt = st.text_area(
|
| 94 |
-
"",
|
| 95 |
-
value=example_text,
|
| 96 |
-
height=100,
|
| 97 |
-
).strip()
|
| 98 |
-
if st.button("Generate code!", key=1):
|
| 99 |
-
with st.spinner("Generating code..."):
|
| 100 |
-
st.code(generate_teaser(gen_prompt))
|
| 101 |
-
read_markdown("utils/intro.md")
|
| 102 |
-
|
| 103 |
-
# Code datasets
|
| 104 |
-
st.subheader("1 - Code datasets")
|
| 105 |
-
read_markdown("datasets/intro.md")
|
| 106 |
-
read_markdown("datasets/github_code.md")
|
| 107 |
-
col1, col2 = st.columns([1, 2])
|
| 108 |
-
with col1:
|
| 109 |
-
selected_model = st.selectbox("", MODELS, key=1)
|
| 110 |
-
read_markdown(f"datasets/{selected_model.lower()}.md")
|
| 111 |
-
|
| 112 |
|
| 113 |
-
# Model architecture
|
| 114 |
-
st.subheader("2 - Model architecture")
|
| 115 |
-
read_markdown("architectures/intro.md")
|
| 116 |
-
col1, col2 = st.columns([1, 2])
|
| 117 |
-
with col1:
|
| 118 |
-
selected_model = st.selectbox("", MODELS, key=2)
|
| 119 |
-
read_markdown(f"architectures/{selected_model.lower()}.md")
|
| 120 |
-
|
| 121 |
-
# Model evaluation
|
| 122 |
-
st.subheader("3 - Code model evaluation")
|
| 123 |
-
read_markdown("evaluation/intro.md")
|
| 124 |
-
read_markdown("evaluation/demo_humaneval.md")
|
| 125 |
-
## quiz
|
| 126 |
-
st.markdown("Below you can try solving this problem or visualize the solution of CodeParrot:")
|
| 127 |
-
with open("evaluation/problem.md", "r") as f:
|
| 128 |
-
problem = f.read()
|
| 129 |
-
with open("evaluation/solution.md", "r") as f:
|
| 130 |
-
solution = f.read()
|
| 131 |
-
|
| 132 |
-
candidate_solution = st.text_area(
|
| 133 |
-
"Complete the problem:",
|
| 134 |
-
value=problem,
|
| 135 |
-
height=240,
|
| 136 |
-
).strip()
|
| 137 |
-
if st.button("Test my solution", key=2):
|
| 138 |
-
with st.spinner("Testing..."):
|
| 139 |
-
code_eval, test_func = load_evaluation()
|
| 140 |
-
test_cases = [test_func]
|
| 141 |
-
candidates = [[candidate_solution]]
|
| 142 |
-
pass_at_k, _ = code_eval.compute(references=test_cases, predictions=candidates)
|
| 143 |
-
text = "Your solution didn't pass the test, pass@1 is 0 😕" if pass_at_k['pass@1'] < 1 else "Congrats your pass@1 is 1! 🎉"
|
| 144 |
-
st.markdown(text)
|
| 145 |
-
if st.button("Show model solution", key=3):
|
| 146 |
-
st.markdown(solution)
|
| 147 |
-
|
| 148 |
# Code generation
|
| 149 |
-
st.subheader("
|
| 150 |
-
|
| 151 |
col1, col2, col3 = st.columns([7, 1, 6])
|
| 152 |
with col1:
|
| 153 |
st.markdown("**Models**")
|
|
|
|
| 78 |
return generations[0]["CodeParrot"]
|
| 79 |
|
| 80 |
st.set_page_config(page_icon=":laptop:", layout="wide")
|
|
|
|
|
|
|
| 81 |
|
|
|
|
| 82 |
|
| 83 |
# Introduction
|
| 84 |
+
st.title("Genera codice online🤗")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
# Code generation
|
| 87 |
+
st.subheader("Genera codice online ✨")
|
| 88 |
+
|
| 89 |
col1, col2, col3 = st.columns([7, 1, 6])
|
| 90 |
with col1:
|
| 91 |
st.markdown("**Models**")
|