max21226 commited on
Commit
f3d5768
1 Parent(s): d4a2c9d
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -1,7 +1,16 @@
1
  import streamlit as st
2
  from transformers import pipeline, set_seed
3
- generator = pipeline('text-generation', model='gpt2')
4
- set_seed(42)
 
 
 
 
 
 
 
 
 
5
  result = generator("I come in peace.", max_length=30, num_return_sequences=5)
6
  for item in result:
7
- st.write (item["generated_text"])
 
1
  import streamlit as st
2
  from transformers import pipeline, set_seed
3
+ from datetime import date
4
+
5
+ def init(generator):
6
+ generator = setupAI()
7
+
8
+ def setupAI():
9
+ generator = pipeline('text-generation', model='gpt2')
10
+ set_seed(date.datetime.now().Second)
11
+ return generator
12
+
13
+ generator = init()
14
  result = generator("I come in peace.", max_length=30, num_return_sequences=5)
15
  for item in result:
16
+ st.write (item["generated_text"])