Spaces:
Runtime error
Runtime error
Akshay Vs
commited on
Commit
•
97df92e
1
Parent(s):
3de3b44
Added functionality
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ from transformers import pipeline, set_seed
|
|
17 |
|
18 |
generator = pipeline('text-generation', model='openai-gpt')
|
19 |
|
20 |
-
def generate(initial_text, length=
|
21 |
set_seed(randint(1,1000))
|
22 |
result = generator(initial_text, max_length = length, num_return_sequences = return_sequences)
|
23 |
return result[0]["generated_text"]
|
@@ -33,17 +33,13 @@ def type_text(text):
|
|
33 |
#text = input("Enter something to begin with... ")
|
34 |
#print(".\n.\n.\nGenerating\n.\n.\n.")
|
35 |
|
36 |
-
text = st.text_input('Enter something to begin with...', placeholder='I
|
|
|
37 |
if text:
|
38 |
-
st.write("Generating...")
|
39 |
for _ in range(50):
|
40 |
result = generate(text)
|
41 |
text=slice(result)
|
42 |
-
result
|
43 |
-
out = ""
|
44 |
-
for i in result:
|
45 |
-
if i == '.':st.title(out)
|
46 |
-
else: out=out+i;
|
47 |
#with concurrent.futures.ThreadPoolExecutor() as executor:
|
48 |
# executor.submit(type_text, result.replace(text,""))
|
49 |
|
|
|
17 |
|
18 |
generator = pipeline('text-generation', model='openai-gpt')
|
19 |
|
20 |
+
def generate(initial_text, length=50, return_sequences=1):
|
21 |
set_seed(randint(1,1000))
|
22 |
result = generator(initial_text, max_length = length, num_return_sequences = return_sequences)
|
23 |
return result[0]["generated_text"]
|
|
|
33 |
#text = input("Enter something to begin with... ")
|
34 |
#print(".\n.\n.\nGenerating\n.\n.\n.")
|
35 |
|
36 |
+
text = st.text_input('Enter something to begin with...', placeholder='I look at her, then i realised...', key="value")
|
37 |
+
st.write("Generating...")
|
38 |
if text:
|
|
|
39 |
for _ in range(50):
|
40 |
result = generate(text)
|
41 |
text=slice(result)
|
42 |
+
st.title(result.replace(text,""))
|
|
|
|
|
|
|
|
|
43 |
#with concurrent.futures.ThreadPoolExecutor() as executor:
|
44 |
# executor.submit(type_text, result.replace(text,""))
|
45 |
|