Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,14 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, set_seed, pipeline
|
|
5 |
title = "Python to Text Converter [WIP]"
|
6 |
description = "This is a space to convert Python code into english text explaining what it does using [codeparrot-small-code-to-text](https://huggingface.co/codeparrot/codeparrot-small-code-to-text),\
|
7 |
a code generation model for Python finetuned on [github-jupyter-code-to-text](https://huggingface.co/datasets/codeparrot/github-jupyter-code-to-text) a dataset of Python code followed by a docstring explaining it, the data was originally extracted from Jupyter notebooks."
|
|
|
|
|
|
|
|
|
|
|
8 |
example = [
|
9 |
-
[
|
10 |
-
[
|
11 |
-
["example3", 87, 0.6, 42],
|
12 |
]
|
13 |
|
14 |
# change model to the finetuned one
|
|
|
5 |
title = "Python to Text Converter [WIP]"
|
6 |
description = "This is a space to convert Python code into english text explaining what it does using [codeparrot-small-code-to-text](https://huggingface.co/codeparrot/codeparrot-small-code-to-text),\
|
7 |
a code generation model for Python finetuned on [github-jupyter-code-to-text](https://huggingface.co/datasets/codeparrot/github-jupyter-code-to-text) a dataset of Python code followed by a docstring explaining it, the data was originally extracted from Jupyter notebooks."
|
8 |
+
|
9 |
+
EXAMPLE_1 = "def bubblesort(elements):\n swapped = False\n for n in range(len(elements)-1, 0, -1):\n for i in range(n):\n if elements[i] > elements[i + 1]:\n swapped = True\n elements[i], elements[i + 1] = elements[i + 1], elements[i]\n if not swapped:\n return"
|
10 |
+
EXAMPLE_2 = "from sklearn.linear_model import LogisticRegression\n\nX_train, X_test, Y_train, Y_test = model_selection.train_test_split(X, Y, test_size=0.2, random_state=0)\
|
11 |
+
\n# Fit the model on training set\nmodel = LogisticRegression()\model.fit(X_train, Y_train)"
|
12 |
+
|
13 |
example = [
|
14 |
+
[EXAMPLE_1, 60, 0.6, 42],
|
15 |
+
[EXAMPLE_2, 60, 0.6, 42],
|
|
|
16 |
]
|
17 |
|
18 |
# change model to the finetuned one
|