ysharma HF staff commited on
Commit
9901ecd
·
1 Parent(s): 631c9e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -27
app.py CHANGED
@@ -30,12 +30,11 @@ handler.register(sa_args)
30
  def style_aligned_multidiff(ref_style_prompt, img_generation_prompt):
31
  view_batch_size = 25 # adjust according to VRAM size
32
  reference_latent = torch.randn(1, 4, 64, 64,)
33
- for target_prompt in target_prompts:
34
- images = pipeline_calls.panorama_call(pipeline,
35
- [ref_style_prompt, img_generation_prompt],
36
- reference_latent=reference_latent,
37
- view_batch_size=view_batch_size)
38
-
39
  return images, gr.Image(value=images[0], visible=True)
40
 
41
 
@@ -44,34 +43,49 @@ with gr.Blocks() as demo:
44
  with gr.Column(variant='panel'):
45
  ref_style_prompt = gr.Textbox(
46
  label='Reference style prompt',
47
- info="Enter a Prompt to generate the reference image",
48
- placeholder='a beautiful papercut art design'
49
  )
50
  ref_style_image = gr.Image(visible=False, label='Reference style image')
51
-
52
  with gr.Column(variant='panel'):
53
  img_generation_prompt = gr.Textbox(
54
  label='MultiDiffusion Prompt',
55
- info="Enter a Prompt to generate panaromic images using Style-aligned combined with MultiDiffusion",
 
56
  )
57
-
58
-
59
- btn = gr.Button("Style-aligned MultiDiffusion - Generate", size='sm')
60
-
61
- gallery = gr.Gallery(label="Style-Aligned ControlNet - Generated images",
62
- elem_id="gallery",
63
- columns=5,
64
- rows=1,
65
- object_fit="contain",
66
- height="auto",
67
- allow_preview=True,
68
  preview=True,
69
  )
70
-
71
- btn.click(fn=style_aligned_multidiff,
72
- inputs=[ref_style_prompt, img_generation_prompt],
73
- outputs=gallery,
74
- api_name="style_aligned_multidiffusion")
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
- demo.launch()
 
30
  def style_aligned_multidiff(ref_style_prompt, img_generation_prompt):
31
  view_batch_size = 25 # adjust according to VRAM size
32
  reference_latent = torch.randn(1, 4, 64, 64,)
33
+ images = pipeline_calls.panorama_call(pipeline,
34
+ [ref_style_prompt, img_generation_prompt],
35
+ reference_latent=reference_latent,
36
+ view_batch_size=view_batch_size)
37
+
 
38
  return images, gr.Image(value=images[0], visible=True)
39
 
40
 
 
43
  with gr.Column(variant='panel'):
44
  ref_style_prompt = gr.Textbox(
45
  label='Reference style prompt',
46
+ info='Enter a Prompt to generate the reference image',
47
+ placeholder='A poster in a papercut art style.'
48
  )
49
  ref_style_image = gr.Image(visible=False, label='Reference style image')
50
+
51
  with gr.Column(variant='panel'):
52
  img_generation_prompt = gr.Textbox(
53
  label='MultiDiffusion Prompt',
54
+ info='Enter a Prompt to generate panaromic images using Style-aligned combined with MultiDiffusion',
55
+ placeholder= 'A village in a papercut art style.'
56
  )
57
+
58
+
59
+ btn = gr.Button('Style-aligned MultiDiffusion - Generate', size='sm')
60
+
61
+ gallery = gr.Gallery(label='Style-Aligned ControlNet - Generated images',
62
+ elem_id='gallery',
63
+ columns=5,
64
+ rows=1,
65
+ object_fit='contain',
66
+ height='auto',
67
+ allow_preview=True,
68
  preview=True,
69
  )
 
 
 
 
 
70
 
71
+ btn.click(fn=style_aligned_multidiff,
72
+ inputs=[ref_style_prompt, img_generation_prompt],
73
+ outputs=[gallery, ref_style_image],
74
+ api_name='style_aligned_multidiffusion')
75
+
76
+
77
+ gr.Examples(
78
+ examples=[
79
+ ['A poster in a papercut art style.', 'A village in a papercut art style.'],
80
+ ['A poster in a papercut art style.', 'Futuristic cityscape in a papercut art style.'],
81
+ ['A poster in a papercut art style.', 'A jungle in a papercut art style.'],
82
+ ['A poster in a flat design style.', 'Girrafes in a flat design style.'],
83
+ ['A poster in a flat design style.', 'Houses in a flat design style.'],
84
+ ['A poster in a flat design style.', 'Mountains in a flat design style.'],
85
+ ],
86
+ inputs=[ref_style_prompt, img_generation_prompt],
87
+ outputs=[gallery, ref_style_image],
88
+ fn=style_aligned_multidiff,
89
+ )
90
 
91
+ demo.launch()