Spaces:
Runtime error
Runtime error
Commit
·
2eff088
1
Parent(s):
329011d
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
import tensorflow as tf
|
4 |
-
|
5 |
#maximum number of words in output text
|
6 |
# MAX_LEN = 30
|
7 |
|
@@ -15,7 +15,7 @@ if st.button('Submit'):
|
|
15 |
|
16 |
tokenizer = AutoTokenizer.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
17 |
model = AutoModelForCausalLM.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
18 |
-
inputs = tokenizer.encode(input_sequence, return_tensors=
|
19 |
# generate text until the output length (which includes the context length) reaches 50
|
20 |
#greedy_output = GPT2.generate(input_ids, max_length = MAX_LEN)
|
21 |
outputs = model(**inputs)
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
import tensorflow as tf
|
4 |
+
import torch
|
5 |
#maximum number of words in output text
|
6 |
# MAX_LEN = 30
|
7 |
|
|
|
15 |
|
16 |
tokenizer = AutoTokenizer.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
17 |
model = AutoModelForCausalLM.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
18 |
+
inputs = tokenizer.encode(input_sequence, return_tensors="pt")
|
19 |
# generate text until the output length (which includes the context length) reaches 50
|
20 |
#greedy_output = GPT2.generate(input_ids, max_length = MAX_LEN)
|
21 |
outputs = model(**inputs)
|