Spaces:
Runtime error
Runtime error
refactor
Browse files
app.py
CHANGED
@@ -1,7 +1,16 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline, set_seed
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"])
|