Daniel Fried commited on
Commit
3443876
1 Parent(s): 7cad3e8

add unlock file

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. modules/app.py +4 -1
  3. static/index.html +7 -15
.gitignore CHANGED
@@ -1,3 +1,4 @@
1
  debug
 
2
  __pycache__
3
  incoder-6B
 
1
  debug
2
+ unlock
3
  __pycache__
4
  incoder-6B
modules/app.py CHANGED
@@ -35,7 +35,10 @@ else:
35
  PORT = 7860
36
  VERBOSE = False
37
 
38
- MAX_LENGTH = 256+64
 
 
 
39
  TRUNCATION_MESSAGE = f'warning: This demo is limited to {MAX_LENGTH} tokens in the document for efficiency.'
40
 
41
  if BIG_MODEL:
 
35
  PORT = 7860
36
  VERBOSE = False
37
 
38
+ if os.path.exists('unlock'):
39
+ MAX_LENGTH = 2048
40
+ else:
41
+ MAX_LENGTH = 256+64
42
  TRUNCATION_MESSAGE = f'warning: This demo is limited to {MAX_LENGTH} tokens in the document for efficiency.'
43
 
44
  if BIG_MODEL:
static/index.html CHANGED
@@ -5,6 +5,8 @@
5
  <meta name="viewport" contents="width=device-width, initial-scale=1.0" />
6
  <title>InCoder</title>
7
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
 
 
8
  <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.14/ace.min.js"></script>
9
  <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.14/mode-plain_text.min.js"></script>
10
  <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.14/mode-c_cpp.min.js"></script>
@@ -383,6 +385,7 @@ def count_words(filename):
383
  };
384
 
385
  var editor = ace.edit("editor");
 
386
  //var editor = null;
387
 
388
  function set_editor_mode(mode) {
@@ -584,14 +587,14 @@ function make_generate_listener(url) {
584
 
585
  function error(err) {
586
  console.log(err);
587
- $("#editor").text("");
588
- $("#prompt").text("");
589
  $("#error").text(err);
590
  }
591
 
592
- encoded_data = encodeURIComponent(btoa(JSON.stringify(send_data)))
593
-
594
  try {
 
 
 
 
595
  const response = await fetch(`${url}?info=${encoded_data}`);
596
  // const response = await fetch(`${url}` {
597
  // method: 'GET',
@@ -609,17 +612,6 @@ function make_generate_listener(url) {
609
  } finally {
610
  complete();
611
  }
612
-
613
- /*
614
- $.ajax({
615
- url: url,
616
- type: "GET",
617
- // processData: true,
618
- // data: send_data,
619
- data: JSON.stringify(send_data),
620
- contentType: 'application/json;charset=UTF-8',
621
- });
622
- */
623
  }
624
  }
625
 
 
5
  <meta name="viewport" contents="width=device-width, initial-scale=1.0" />
6
  <title>InCoder</title>
7
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/base64.min.js"></script>
9
+
10
  <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.14/ace.min.js"></script>
11
  <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.14/mode-plain_text.min.js"></script>
12
  <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.14/mode-c_cpp.min.js"></script>
 
385
  };
386
 
387
  var editor = ace.edit("editor");
388
+ editor.setOption("wrap", true);
389
  //var editor = null;
390
 
391
  function set_editor_mode(mode) {
 
587
 
588
  function error(err) {
589
  console.log(err);
 
 
590
  $("#error").text(err);
591
  }
592
 
 
 
593
  try {
594
+ var stringified = JSON.stringify(send_data);
595
+ // var encoded_data = encodeURIComponent(btoa(stringified));
596
+ var encoded_data = Base64.encodeURI(stringified);
597
+
598
  const response = await fetch(`${url}?info=${encoded_data}`);
599
  // const response = await fetch(`${url}` {
600
  // method: 'GET',
 
612
  } finally {
613
  complete();
614
  }
 
 
 
 
 
 
 
 
 
 
 
615
  }
616
  }
617