Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,13 +10,10 @@ def expand_prompt(prompt, num_variants=5, max_length=100):
|
|
10 |
"""
|
11 |
Given a basic prompt, generate `num_variants` expanded prompts using GPT-J-6B.
|
12 |
"""
|
13 |
-
# Generate multiple completions using sampling.
|
14 |
outputs = generator(prompt, max_length=max_length, num_return_sequences=num_variants, do_sample=True)
|
15 |
-
# Clean and join the outputs
|
16 |
expanded = [out["generated_text"].strip() for out in outputs]
|
17 |
return "\n\n".join(expanded)
|
18 |
|
19 |
-
# Create a Gradio Interface
|
20 |
iface = gr.Interface(
|
21 |
fn=expand_prompt,
|
22 |
inputs=gr.Textbox(lines=2, placeholder="Enter your basic prompt here...", label="Basic Prompt"),
|
@@ -31,4 +28,3 @@ iface = gr.Interface(
|
|
31 |
|
32 |
if __name__ == "__main__":
|
33 |
iface.launch()
|
34 |
-
|
|
|
10 |
"""
|
11 |
Given a basic prompt, generate `num_variants` expanded prompts using GPT-J-6B.
|
12 |
"""
|
|
|
13 |
outputs = generator(prompt, max_length=max_length, num_return_sequences=num_variants, do_sample=True)
|
|
|
14 |
expanded = [out["generated_text"].strip() for out in outputs]
|
15 |
return "\n\n".join(expanded)
|
16 |
|
|
|
17 |
iface = gr.Interface(
|
18 |
fn=expand_prompt,
|
19 |
inputs=gr.Textbox(lines=2, placeholder="Enter your basic prompt here...", label="Basic Prompt"),
|
|
|
28 |
|
29 |
if __name__ == "__main__":
|
30 |
iface.launch()
|
|