Spaces:
Runtime error
Runtime error
update app
Browse files
app.py
CHANGED
|
@@ -6,8 +6,8 @@ from transformers import pipeline
|
|
| 6 |
title = "CodeParrot Generator"
|
| 7 |
description = "This is a subspace to make code generation with CodeParrot, it is used in a larger space for model comparison."
|
| 8 |
example = "def print_hello_world():\n \"""Print 'Hello world' \""" "
|
| 9 |
-
tokenizer =
|
| 10 |
-
model =
|
| 11 |
|
| 12 |
|
| 13 |
def code_generation(gen_prompt, strategy, max_tokens, seed=42):
|
|
@@ -24,7 +24,7 @@ def code_generation(gen_prompt, strategy, max_tokens, seed=42):
|
|
| 24 |
return generated_text
|
| 25 |
|
| 26 |
|
| 27 |
-
|
| 28 |
fn=code_generation,
|
| 29 |
inputs=[
|
| 30 |
gr.Textbox(lines=10, label="Input code"),
|
|
@@ -51,4 +51,4 @@ interface = gr.Interface(
|
|
| 51 |
description=description,
|
| 52 |
title=title
|
| 53 |
)
|
| 54 |
-
|
|
|
|
| 6 |
title = "CodeParrot Generator"
|
| 7 |
description = "This is a subspace to make code generation with CodeParrot, it is used in a larger space for model comparison."
|
| 8 |
example = "def print_hello_world():\n \"""Print 'Hello world' \""" "
|
| 9 |
+
tokenizer = AutoTokenizer.from_pretrained("lvwerra/codeparrot")
|
| 10 |
+
model = AutoModelForCausalLM.from_pretrained("lvwerra/codeparrot", low_cpu_mem_usage=True)
|
| 11 |
|
| 12 |
|
| 13 |
def code_generation(gen_prompt, strategy, max_tokens, seed=42):
|
|
|
|
| 24 |
return generated_text
|
| 25 |
|
| 26 |
|
| 27 |
+
iface = gr.Interface(
|
| 28 |
fn=code_generation,
|
| 29 |
inputs=[
|
| 30 |
gr.Textbox(lines=10, label="Input code"),
|
|
|
|
| 51 |
description=description,
|
| 52 |
title=title
|
| 53 |
)
|
| 54 |
+
iface.launch()
|