awacke1 commited on
Commit
c60c8cf
1 Parent(s): 8f99b37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -53,6 +53,7 @@ mname = "facebook/blenderbot-400M-distill"
53
  model = BlenderbotForConditionalGeneration.from_pretrained(mname)
54
  tokenizer = BlenderbotTokenizer.from_pretrained(mname)
55
 
 
56
  def take_last_tokens(inputs, note_history, history):
57
  """Filter the last 128 tokens"""
58
  if inputs['input_ids'].shape[1] > 128:
@@ -61,6 +62,12 @@ def take_last_tokens(inputs, note_history, history):
61
  note_history = ['</s> <s>'.join(note_history[0].split('</s> <s>')[2:])]
62
  history = history[1:]
63
  return inputs, note_history, history
 
 
 
 
 
 
64
 
65
 
66
  title = "💬ChatBack🧠💾"
 
53
  model = BlenderbotForConditionalGeneration.from_pretrained(mname)
54
  tokenizer = BlenderbotTokenizer.from_pretrained(mname)
55
 
56
+
57
  def take_last_tokens(inputs, note_history, history):
58
  """Filter the last 128 tokens"""
59
  if inputs['input_ids'].shape[1] > 128:
 
62
  note_history = ['</s> <s>'.join(note_history[0].split('</s> <s>')[2:])]
63
  history = history[1:]
64
  return inputs, note_history, history
65
+
66
+ def add_note_to_history(note, note_history):
67
+ """Add a note to the historical information"""
68
+ note_history.append(note)
69
+ note_history = '</s> <s>'.join(note_history)
70
+ return [note_history]
71
 
72
 
73
  title = "💬ChatBack🧠💾"