Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, set_seed, pipeline
|
|
3 |
|
4 |
|
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](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 |
["example1", 65, 0.6, 42],
|
@@ -12,8 +12,8 @@ example = [
|
|
12 |
]
|
13 |
|
14 |
# change model to the finetuned one
|
15 |
-
tokenizer = AutoTokenizer.from_pretrained("codeparrot/codeparrot-small")
|
16 |
-
model = AutoModelForCausalLM.from_pretrained("codeparrot/codeparrot-small")
|
17 |
|
18 |
def make_doctring(gen_prompt):
|
19 |
return gen_prompt + f"\n\n\"\"\"\nExplanation:"
|
|
|
3 |
|
4 |
|
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 |
["example1", 65, 0.6, 42],
|
|
|
12 |
]
|
13 |
|
14 |
# change model to the finetuned one
|
15 |
+
tokenizer = AutoTokenizer.from_pretrained("codeparrot/codeparrot-small-code-to-text")
|
16 |
+
model = AutoModelForCausalLM.from_pretrained("codeparrot/codeparrot-small-code-to-text")
|
17 |
|
18 |
def make_doctring(gen_prompt):
|
19 |
return gen_prompt + f"\n\n\"\"\"\nExplanation:"
|