SudhanshuBlaze commited on
Commit
8fdcd7c
·
1 Parent(s): 72302dd

add cache optimisation for loading model

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -5,7 +5,12 @@ st.title("AI text-gen Web-app")
5
  st.write("This is auto-complete/text generation a web-app powered by GPT-neo. GPT-Neo 125M is a transformer model designed using EleutherAI's replication of the GPT-3 architecture. GPT-Neo refers to the class of models, while 125M represents the number of parameters of this particular pre-trained model.")
6
 
7
  # instantiate the model / download
8
- generator = pipeline('text-generation', model='EleutherAI/gpt-neo-125M')
 
 
 
 
 
9
 
10
  min_length=st.slider(
11
  'Specify Min length of the text of want to be generated',
 
5
  st.write("This is auto-complete/text generation a web-app powered by GPT-neo. GPT-Neo 125M is a transformer model designed using EleutherAI's replication of the GPT-3 architecture. GPT-Neo refers to the class of models, while 125M represents the number of parameters of this particular pre-trained model.")
6
 
7
  # instantiate the model / download
8
+ @st.cache(allow_output_mutation=True)
9
+ def load_model():
10
+ generator = pipeline('text-generation', model='EleutherAI/gpt-neo-125M')
11
+ return (generator)
12
+
13
+ generator=load_model()
14
 
15
  min_length=st.slider(
16
  'Specify Min length of the text of want to be generated',