Spaces:
Runtime error
Runtime error
Commit
·
7f39fb2
1
Parent(s):
dac8d18
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,12 +16,12 @@ def rename_customer(id, newName):\n\t# PROMPT\n\tcur.execute("UPDATE customer SE
|
|
| 16 |
"""
|
| 17 |
|
| 18 |
modelPath = {
|
| 19 |
-
"GPT2-Medium": "gpt2-medium",
|
| 20 |
"CodeParrot-mini": "codeparrot/codeparrot-small",
|
| 21 |
"CodeGen-350-Mono": "Salesforce/codegen-350M-mono",
|
| 22 |
-
"GPT-Neo-1.3B": "EleutherAI/gpt-neo-1.3B",
|
| 23 |
-
"CodeParrot": "codeparrot/codeparrot",
|
| 24 |
-
"CodeGen-2B-Mono": "Salesforce/codegen-2B-mono",
|
| 25 |
}
|
| 26 |
|
| 27 |
def generation(tokenizer, model, content):
|
|
@@ -87,18 +87,18 @@ def get_customer(id):\n\tcur.execute('SELECT * FROM customers WHERE id = %s', st
|
|
| 87 |
iface = gr.Interface(
|
| 88 |
fn=code_from_prompts,
|
| 89 |
inputs=[
|
| 90 |
-
gr.
|
| 91 |
-
gr.
|
| 92 |
-
gr.
|
| 93 |
-
gr.
|
| 94 |
"None",
|
| 95 |
"Proper composition: Include function 'WHERE id = %s'",
|
| 96 |
"Concatenation: Include a function with 'WHERE id = ' + id",
|
| 97 |
-
], label="
|
| 98 |
],
|
| 99 |
outputs=[
|
| 100 |
-
gr.
|
| 101 |
-
gr.
|
| 102 |
],
|
| 103 |
description="Prompt the code model to write a SQL query with string concatenation.",
|
| 104 |
)
|
|
|
|
| 16 |
"""
|
| 17 |
|
| 18 |
modelPath = {
|
| 19 |
+
# "GPT2-Medium": "gpt2-medium",
|
| 20 |
"CodeParrot-mini": "codeparrot/codeparrot-small",
|
| 21 |
"CodeGen-350-Mono": "Salesforce/codegen-350M-mono",
|
| 22 |
+
# "GPT-Neo-1.3B": "EleutherAI/gpt-neo-1.3B",
|
| 23 |
+
# "CodeParrot": "codeparrot/codeparrot",
|
| 24 |
+
# "CodeGen-2B-Mono": "Salesforce/codegen-2B-mono",
|
| 25 |
}
|
| 26 |
|
| 27 |
def generation(tokenizer, model, content):
|
|
|
|
| 87 |
iface = gr.Interface(
|
| 88 |
fn=code_from_prompts,
|
| 89 |
inputs=[
|
| 90 |
+
gr.components.Textbox(label="Insert comment"),
|
| 91 |
+
gr.components.Radio(list(modelPath.keys()), label="Code Model"),
|
| 92 |
+
gr.components.Checkbox(label="Include type hints"),
|
| 93 |
+
gr.components.Radio([
|
| 94 |
"None",
|
| 95 |
"Proper composition: Include function 'WHERE id = %s'",
|
| 96 |
"Concatenation: Include a function with 'WHERE id = ' + id",
|
| 97 |
+
], label="Has user already written a function?")
|
| 98 |
],
|
| 99 |
outputs=[
|
| 100 |
+
gr.components.Textbox(label="Most probable code"),
|
| 101 |
+
gr.components.Textbox(label="Probability of concat"),
|
| 102 |
],
|
| 103 |
description="Prompt the code model to write a SQL query with string concatenation.",
|
| 104 |
)
|