Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,25 +8,21 @@ pipe = pipeline(
|
|
8 |
tokenizer="gpt2"
|
9 |
)
|
10 |
|
11 |
-
#
|
12 |
-
history = []
|
13 |
-
|
14 |
-
# Function to generate text based on input prompt and record the history
|
15 |
def generate_text(prompt):
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
return generated_text
|
20 |
|
21 |
-
# Create a Gradio interface
|
22 |
iface = gr.Interface(
|
23 |
fn=generate_text,
|
24 |
inputs=gr.Textbox(lines=5, label="Prompt"),
|
25 |
-
outputs=gr.Textbox(label="Output",
|
26 |
title="AI Art Prompt Generator",
|
27 |
-
description="
|
28 |
-
|
29 |
)
|
30 |
|
31 |
# Launch the interface
|
32 |
-
iface.launch(
|
|
|
8 |
tokenizer="gpt2"
|
9 |
)
|
10 |
|
11 |
+
# Function to generate text based on input prompt
|
|
|
|
|
|
|
12 |
def generate_text(prompt):
|
13 |
+
# Generate multiple outputs for the same prompt
|
14 |
+
generated_texts = [pipe(prompt, max_length=77)[0]["generated_text"] for _ in range(5)]
|
15 |
+
return generated_texts
|
|
|
16 |
|
17 |
+
# Create a Gradio interface
|
18 |
iface = gr.Interface(
|
19 |
fn=generate_text,
|
20 |
inputs=gr.Textbox(lines=5, label="Prompt"),
|
21 |
+
outputs=[gr.Textbox(label=f"Output {i+1}", readonly=True, multiline=True) for i in range(5)],
|
22 |
title="AI Art Prompt Generator",
|
23 |
+
description="This tool generates multiple outputs for a given prompt using the AI Art Prompt Generator model.",
|
24 |
+
allow_flagging=False
|
25 |
)
|
26 |
|
27 |
# Launch the interface
|
28 |
+
iface.launch()
|