Spaces:
Running
Running
Update app.py
Browse filesUpdated deprecated syntax to current
app.py
CHANGED
@@ -3,14 +3,14 @@ import streamlit as st
|
|
3 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
4 |
from transformers import pipeline
|
5 |
|
6 |
-
@st.
|
7 |
def load_model():
|
8 |
model_ckpt = "flax-community/gpt2-rap-lyric-generator"
|
9 |
tokenizer = AutoTokenizer.from_pretrained(model_ckpt,from_flax=True)
|
10 |
model = AutoModelForCausalLM.from_pretrained(model_ckpt,from_flax=True)
|
11 |
return tokenizer, model
|
12 |
|
13 |
-
@st.
|
14 |
def load_rappers():
|
15 |
text_file = open("rappers.txt")
|
16 |
rappers = text_file.readlines()
|
|
|
3 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
4 |
from transformers import pipeline
|
5 |
|
6 |
+
@st.cache_data(allow_output_mutation=True)
|
7 |
def load_model():
|
8 |
model_ckpt = "flax-community/gpt2-rap-lyric-generator"
|
9 |
tokenizer = AutoTokenizer.from_pretrained(model_ckpt,from_flax=True)
|
10 |
model = AutoModelForCausalLM.from_pretrained(model_ckpt,from_flax=True)
|
11 |
return tokenizer, model
|
12 |
|
13 |
+
@st.cache_data()
|
14 |
def load_rappers():
|
15 |
text_file = open("rappers.txt")
|
16 |
rappers = text_file.readlines()
|