Spaces:
Build error
Build error
Error correction
Browse files
app.py
CHANGED
|
@@ -20,8 +20,11 @@ def tokenize_data(text):
|
|
| 20 |
|
| 21 |
def generate_answers(text):
|
| 22 |
inputs = tokenize_data(text)
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
| 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"]]
|