georeactor commited on
Commit
a2c859f
·
1 Parent(s): 190f1a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -84,7 +84,10 @@ def code_from_prompts(
84
  tokenizer = AutoTokenizer.from_pretrained(modelPath["CodeParrot-small"])
85
  model = preloadModels["CodeParrot-small"]
86
 
87
- code = clean_comment(headerComment) + "\n"
 
 
 
88
  code += header.strip().replace('CONN', "dbname='store'").replace('PROMPT', clean_comment(fnComment))
89
 
90
  if type_hints:
@@ -121,8 +124,8 @@ iface = gr.Interface(
121
  fn=code_from_prompts,
122
  inputs=[
123
  gr.components.Checkbox(label="Submit score to server", value=True),
124
- gr.components.Textbox(label="Header comment"),
125
- gr.components.Textbox(label="Function comment", label="Top injection comments: " + ",".join(topComments)),
126
  # gr.components.Radio(list(modelPath.keys()), label="Code Model"),
127
  gr.components.Checkbox(label="Include type hints"),
128
  gr.components.Radio([
 
84
  tokenizer = AutoTokenizer.from_pretrained(modelPath["CodeParrot-small"])
85
  model = preloadModels["CodeParrot-small"]
86
 
87
+ code = ""
88
+ headerComment = headerComment.strip()
89
+ if len(headerComment) > 0:
90
+ code += "# " + clean_comment(headerComment) + "\n"
91
  code += header.strip().replace('CONN', "dbname='store'").replace('PROMPT', clean_comment(fnComment))
92
 
93
  if type_hints:
 
124
  fn=code_from_prompts,
125
  inputs=[
126
  gr.components.Checkbox(label="Submit score to server", value=True),
127
+ gr.components.Textbox(label="Header comment", placeholder="OK to leave blank"),
128
+ gr.components.Textbox(label="Function comment"),
129
  # gr.components.Radio(list(modelPath.keys()), label="Code Model"),
130
  gr.components.Checkbox(label="Include type hints"),
131
  gr.components.Radio([