RamAnanth1 commited on
Commit
7385ebd
1 Parent(s): 891954c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -20,16 +20,20 @@ def infer(input):
20
  prompt = pipe(input+',', num_return_sequences=1)[0]["generated_text"]
21
  img = get_images(prompt)
22
  result = get_new_prompt(img, 'fast')
23
- return result[0]
24
 
25
  input_prompt = gr.Text(label="Enter the initial prompt")
26
- sd2_output = gr.Text(label="Extended prompt suitable for Stable Diffusion 2")
27
-
28
-
29
- gr.Markdown(""" ## Prompt Extender for SD 2 """)
30
- gr.HTML('''<p style="margin-bottom: 10px; font-size: 94%">
31
- Enter a main initial idea for a prompt, and the model will generate a prompt suitable for Stable Diffusion 2</p>''')
32
-
33
- demo = gr.Interface(fn=infer, inputs=input_prompt, outputs=sd2_output)
 
 
 
 
34
  demo.queue(max_size=10,concurrency_count=20)
35
  demo.launch(enable_queue=True)
 
20
  prompt = pipe(input+',', num_return_sequences=1)[0]["generated_text"]
21
  img = get_images(prompt)
22
  result = get_new_prompt(img, 'fast')
23
+ return prompt,result[0]
24
 
25
  input_prompt = gr.Text(label="Enter the initial prompt")
26
+ sd1_output = gr.Text(label="Extended prompt suitable for Stable Diffusion 1.x")
27
+ sd2_output = gr.Text(label="Extended prompt suitable for Stable Diffusion 2.x")
28
+
29
+ description="""
30
+ <p style="text-align:center;">
31
+ Since Stable Diffusion 2 uses OpenCLIP ViT-H model trained on LAION dataset compared to the OpenAI ViT-L we're all used to prompting, the prompting style varies and the exact prompt is often hard to write.
32
+ <br />This demo extends an initial idea and generates suitable prompts compatible with v1.x stable diffusion and v2.x stable diffusion,
33
+ <br />by generating an image through <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" target="_blank">RunwayML Stable Diffusion 1.5</a>, then Interrogate the resulting image through <a href="https://huggingface.co/spaces/fffiloni/CLIP-Interrogator-2" target="_blank">CLIP Interrogator 2</a> to give you a Stable Diffusion 2 equivalent prompt.
34
+ </p>
35
+ """
36
+
37
+ demo = gr.Interface(fn=infer, inputs=input_prompt, outputs=[sd1_output,sd2_output], description = description)
38
  demo.queue(max_size=10,concurrency_count=20)
39
  demo.launch(enable_queue=True)