Jezia commited on
Commit
38a8124
·
1 Parent(s): 2f8466b

Error correction

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -20,8 +20,11 @@ def tokenize_data(text):
20
 
21
  def generate_answers(text):
22
  inputs = tokenize_data(text)
23
- results= model.predict(inputs['input_ids'])
24
- answer = tokenizer.decode(results[0], skip_special_tokens=True)
 
 
 
25
  return answer
26
 
27
  examples = [["Once upon a time, "], ["In a galaxy far far away"]]
 
20
 
21
  def generate_answers(text):
22
  inputs = tokenize_data(text)
23
+ x = tf.dtypes.cast(inputs['input_ids'], tf.int64)
24
+ predictions, _ = model.predict(x)
25
+ results = np.argmax(predictions, axis=1)
26
+ print(results)
27
+ answer = tokenizer.decode(results[0].flatten(), skip_special_tokens=True)
28
  return answer
29
 
30
  examples = [["Once upon a time, "], ["In a galaxy far far away"]]