Spaces:
Runtime error
Runtime error
yash161101
commited on
Commit
•
585e44d
1
Parent(s):
c114350
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,6 @@ import streamlit as st
|
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
import tensorflow as tf
|
4 |
|
5 |
-
#for reproducability
|
6 |
-
SEED = 64
|
7 |
-
|
8 |
#maximum number of words in output text
|
9 |
# MAX_LEN = 30
|
10 |
|
@@ -16,13 +13,8 @@ MAX_LEN = number
|
|
16 |
|
17 |
if st.button('Submit'):
|
18 |
|
19 |
-
#get transformers
|
20 |
-
from transformers import TFGPT2LMHeadModel, GPT2Tokenizer
|
21 |
-
|
22 |
tokenizer = AutoTokenizer.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
23 |
model = AutoModelForCausalLM.from_pretrained("ml6team/gpt-2-medium-conditional-quote-generator")
|
24 |
-
tf.random.set_seed(SEED)
|
25 |
-
|
26 |
inputs = tokenizer.encode(input_sequence, return_tensors='pt')
|
27 |
|
28 |
# generate text until the output length (which includes the context length) reaches 50
|
|
|
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 |
|
|
|
13 |
|
14 |
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='pt')
|
19 |
|
20 |
# generate text until the output length (which includes the context length) reaches 50
|