Daniel Fried commited on
Commit
29e0eba
1 Parent(s): 537df60

update exs

Browse files
Files changed (2) hide show
  1. modules/app.py +2 -0
  2. static/index.html +9 -3
modules/app.py CHANGED
@@ -182,6 +182,8 @@ async def infill_maybe(info: str):
182
  max_retries = 1
183
  extra_sentinel = True
184
  try:
 
 
185
  generation = infill(form['parts'], length_limit, temperature, extra_sentinel=extra_sentinel, max_retries=max_retries)
186
  generation['result'] = 'success'
187
  generation['type'] = 'infill'
 
182
  max_retries = 1
183
  extra_sentinel = True
184
  try:
185
+ if len(form['parts']) > 4:
186
+ return {'result': 'error', 'type': 'infill', 'message': f"error: Can't use more than 3 <infill> tokens in this demo (for efficiency)."}
187
  generation = infill(form['parts'], length_limit, temperature, extra_sentinel=extra_sentinel, max_retries=max_retries)
188
  generation['result'] = 'success'
189
  generation['type'] = 'infill'
static/index.html CHANGED
@@ -241,7 +241,9 @@ var Range = require("ace/range").Range;
241
  var EXAMPLES = {
242
  "python-infill2": {
243
  "prompt":
244
- `from collections import Counter
 
 
245
  def <infill>
246
  """Count the number of occurrences of each word in the file."""
247
  <infill>
@@ -253,7 +255,9 @@ def <infill>
253
 
254
  "type-pred": {
255
  "prompt":
256
- `def count_words(filename: str) -> <infill>
 
 
257
  """Count the number of occurrences of each word in the file."""
258
  with open(filename, 'r') as f:
259
  word_counts = {}
@@ -271,7 +275,9 @@ def <infill>
271
  },
272
  "docstring": {
273
  "prompt":
274
- `def count_words(filename: str) -> Dict[str, int]:
 
 
275
  """<infill>
276
  """
277
  with open(filename, 'r') as f:
 
241
  var EXAMPLES = {
242
  "python-infill2": {
243
  "prompt":
244
+ `<| file ext=.py |>
245
+
246
+ from collections import Counter
247
  def <infill>
248
  """Count the number of occurrences of each word in the file."""
249
  <infill>
 
255
 
256
  "type-pred": {
257
  "prompt":
258
+ `<| file ext=.py |>
259
+
260
+ def count_words(filename: str) -> <infill>
261
  """Count the number of occurrences of each word in the file."""
262
  with open(filename, 'r') as f:
263
  word_counts = {}
 
275
  },
276
  "docstring": {
277
  "prompt":
278
+ `<| file ext=.py |>
279
+
280
+ def count_words(filename: str) -> Dict[str, int]:
281
  """<infill>
282
  """
283
  with open(filename, 'r') as f: