Spaces:
Runtime error
Runtime error
yash161101
commited on
Commit
•
ceafc2c
1
Parent(s):
7381dbc
Update app.py
Browse files
app.py
CHANGED
@@ -21,16 +21,16 @@ if st.button('Submit'):
|
|
21 |
|
22 |
tokenizer = AutoTokenizer.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
23 |
GPT2 = model = AutoModelForCausalLM.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
24 |
-
|
25 |
-
import tensorflow as tf
|
26 |
tf.random.set_seed(SEED)
|
|
|
27 |
input_ids = tokenizer.encode(input_sequence, return_tensors='tf')
|
28 |
|
29 |
# generate text until the output length (which includes the context length) reaches 50
|
30 |
-
greedy_output = GPT2.generate(input_ids, max_length = MAX_LEN)
|
|
|
31 |
|
32 |
print("Output:\n" + 100 * '-')
|
33 |
-
print(tokenizer.decode(
|
34 |
else:
|
35 |
st.write(' ')
|
36 |
|
|
|
21 |
|
22 |
tokenizer = AutoTokenizer.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
23 |
GPT2 = model = AutoModelForCausalLM.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
|
|
|
|
24 |
tf.random.set_seed(SEED)
|
25 |
+
|
26 |
input_ids = tokenizer.encode(input_sequence, return_tensors='tf')
|
27 |
|
28 |
# generate text until the output length (which includes the context length) reaches 50
|
29 |
+
#greedy_output = GPT2.generate(input_ids, max_length = MAX_LEN)
|
30 |
+
outputs = model(**inputs)
|
31 |
|
32 |
print("Output:\n" + 100 * '-')
|
33 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens = True))
|
34 |
else:
|
35 |
st.write(' ')
|
36 |
|