Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,18 +8,17 @@ gpt2_pipe = pipeline('text-generation', model='succinctly/text2image-prompt-gene
|
|
8 |
def generate(starting_text):
|
9 |
seed = random.randint(1, 100000)
|
10 |
set_seed(seed)
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
print(f"Repeat: {response}")
|
15 |
-
else:
|
16 |
-
return response[1]['generated_text']
|
17 |
|
18 |
|
19 |
txt = grad.Textbox(lines=1, label="English", placeholder="English Text here")
|
20 |
-
out = grad.Textbox(lines=
|
21 |
|
22 |
-
grad.Interface(fn=generate,
|
|
|
|
|
23 |
allow_flagging='never',
|
24 |
cache_examples=False,
|
25 |
-
theme="default").launch(enable_queue=True, debug=True)
|
|
|
8 |
def generate(starting_text):
|
9 |
seed = random.randint(1, 100000)
|
10 |
set_seed(seed)
|
11 |
+
response = gpt2_pipe(starting_text, max_length=30, num_return_sequences=random.randint(5, 15))
|
12 |
+
response_list = "\n".join(response)
|
13 |
+
return response_list
|
|
|
|
|
|
|
14 |
|
15 |
|
16 |
txt = grad.Textbox(lines=1, label="English", placeholder="English Text here")
|
17 |
+
out = grad.Textbox(lines=5, label="Generated Text")
|
18 |
|
19 |
+
grad.Interface(fn=generate,
|
20 |
+
inputs=txt,
|
21 |
+
outputs=out,
|
22 |
allow_flagging='never',
|
23 |
cache_examples=False,
|
24 |
+
theme="default").launch(enable_queue=True, debug=True)
|