File size: 751 Bytes
a1a1ce3
52d9e34
a1a1ce3
52d9e34
a1a1ce3
52d9e34
c6b8cf6
52d9e34
 
 
 
d79edb1
 
 
 
52d9e34
3a8ae8f
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline

pipe = pipeline('text-generation', model='daspartho/prompt-extend')

def extend_prompt(input):
    return pipe(input+',', num_return_sequences=1)[0]["generated_text"]

input_prompt = gr.Text(label="Enter the initial prompt")
sd2_output = gr.Text(label="Extended prompt suitable for Stable Diffusion 2")

gr.Markdown(""" ## Prompt Extender for SD 2 """)
gr.HTML('''<p style="margin-bottom: 10px; font-size: 94%">
            Enter a main initial idea for a prompt, and the model will generate a prompt suitable for Stable Diffusion 2</p>''')

demo = gr.Interface(fn=extend_prompt, inputs=input_prompt, outputs=sd2_output)
demo.queue(max_size=10,concurrency_count=20)
demo.launch(enable_queue=True)