dennis-fast commited on
Commit
fb55ceb
1 Parent(s): 110cf2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -22,7 +22,7 @@ def predict(input, history=[]):
22
  max_length=1000,
23
  #max_length=200,
24
  pad_token_id=tokenizer.eos_token_id,
25
- #no_repeat_ngram_size=3,
26
  #do_sample=True,
27
  #temperature = 0.8
28
  top_p=0.92,
@@ -31,9 +31,12 @@ def predict(input, history=[]):
31
 
32
  # convert the tokens to text, and then split the responses into the right format
33
  response = tokenizer.decode(history[0]).split("<|endoftext|>")
 
34
  response = [(response[i], response[i+1]) for i in range(0, len(response)-1, 2)] # convert to tuples of list
35
- print(response)
36
- print(history)
 
 
37
  return response, history
38
 
39
  gr.Interface(fn=predict,
 
22
  max_length=1000,
23
  #max_length=200,
24
  pad_token_id=tokenizer.eos_token_id,
25
+ no_repeat_ngram_size=3,
26
  #do_sample=True,
27
  #temperature = 0.8
28
  top_p=0.92,
 
31
 
32
  # convert the tokens to text, and then split the responses into the right format
33
  response = tokenizer.decode(history[0]).split("<|endoftext|>")
34
+
35
  response = [(response[i], response[i+1]) for i in range(0, len(response)-1, 2)] # convert to tuples of list
36
+
37
+ if len(response) > 5:
38
+ response.pop(0)
39
+
40
  return response, history
41
 
42
  gr.Interface(fn=predict,