fffiloni commited on
Commit
3b61509
·
1 Parent(s): b2e4795

adapt for wallpaper format

Browse files
Files changed (1) hide show
  1. app.py +55 -46
app.py CHANGED
@@ -62,6 +62,8 @@ def infer(prompt, seed, randomize_seed):
62
  guidance_scale=0,
63
  num_inference_steps=NUM_INFERENCE_STEPS,
64
  generator=generator,
 
 
65
  ).images[0]
66
 
67
  return image
@@ -82,7 +84,7 @@ examples = [
82
  css = """
83
  #col-container {
84
  margin: 0 auto;
85
- max-width: 512px;
86
  }
87
  """
88
 
@@ -93,52 +95,59 @@ else:
93
 
94
  with gr.Blocks(css=css) as demo:
95
  with gr.Column(elem_id="col-container"):
96
- gr.Markdown(
97
- f"""
98
- # ⚡ Flash Diffusion: FlashPixart ⚡
99
- This is an interactive demo of [Flash Diffusion](https://gojasper.github.io/flash-diffusion-project/), a diffusion distillation method proposed in [Flash Diffusion: Accelerating Any Conditional
100
- Diffusion Model for Few Steps Image Generation](http://arxiv.org/abs/2406.02347) *by Clément Chadebec, Onur Tasar, Eyal Benaroche and Benjamin Aubin* from Jasper Research.
101
- [This model](https://huggingface.co/jasperai/flash-pixart) is a **66.5M** LoRA distilled version of [Pixart-α](https://huggingface.co/PixArt-alpha/PixArt-XL-2-1024-MS) model that is able to generate 1024x1024 images in **4 steps**.
102
- Currently running on {power_device}.
103
- """
104
- )
105
- gr.Markdown(
106
- "If you enjoy the space, please also promote *open-source* by giving a ⭐ to the <a href='https://github.com/gojasper/flash-diffusion' target='_blank'>Github Repo</a>."
107
- )
108
- gr.Markdown(
109
- "💡 *Hint:* To better appreciate the low latency of our method, run the demo locally !"
110
- )
111
-
112
  with gr.Row():
113
- prompt = gr.Text(
114
- label="Prompt",
115
- show_label=False,
116
- max_lines=1,
117
- placeholder="Enter your prompt",
118
- container=False,
119
- )
120
-
121
- run_button = gr.Button("Run", scale=0)
122
-
123
- result = gr.Image(label="Result", show_label=False)
124
-
125
- with gr.Accordion("Advanced Settings", open=False):
126
- seed = gr.Slider(
127
- label="Seed",
128
- minimum=0,
129
- maximum=MAX_SEED,
130
- step=1,
131
- value=0,
132
- )
133
-
134
- randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
135
-
136
- examples = gr.Examples(examples=examples, inputs=[prompt])
137
-
138
- gr.Markdown("**Disclaimer:**")
139
- gr.Markdown(
140
- "This demo is only for research purpose. Jasper cannot be held responsible for the generation of NSFW (Not Safe For Work) content through the use of this demo. Users are solely responsible for any content they create, and it is their obligation to ensure that it adheres to appropriate and ethical standards. Jasper provides the tools, but the responsibility for their use lies with the individual user."
141
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  gr.on(
143
  [run_button.click, seed.change, randomize_seed.change, prompt.submit],
144
  fn=infer,
 
62
  guidance_scale=0,
63
  num_inference_steps=NUM_INFERENCE_STEPS,
64
  generator=generator,
65
+ width=464,
66
+ height=1024
67
  ).images[0]
68
 
69
  return image
 
84
  css = """
85
  #col-container {
86
  margin: 0 auto;
87
+ max-width: 1080px;
88
  }
89
  """
90
 
 
95
 
96
  with gr.Blocks(css=css) as demo:
97
  with gr.Column(elem_id="col-container"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  with gr.Row():
99
+ with gr.Column():
100
+ gr.Markdown(
101
+ f"""
102
+ # ⚡ Flash Diffusion for Phone Wallpapers ⚡
103
+ This space version will generate 464x1024 images for your smartphones :)
104
+
105
+ This is an interactive demo of [Flash Diffusion](https://gojasper.github.io/flash-diffusion-project/), a diffusion distillation method proposed in [Flash Diffusion: Accelerating Any Conditional
106
+ Diffusion Model for Few Steps Image Generation](http://arxiv.org/abs/2406.02347) *by Clément Chadebec, Onur Tasar, Eyal Benaroche and Benjamin Aubin* from Jasper Research.
107
+ [This model](https://huggingface.co/jasperai/flash-pixart) is a **66.5M** LoRA distilled version of [Pixart-α](https://huggingface.co/PixArt-alpha/PixArt-XL-2-1024-MS) model that is able to generate 1024x1024 images in **4 steps**.
108
+ Currently running on {power_device}.
109
+ """
110
+ )
111
+ gr.Markdown(
112
+ "If you enjoy the space, please also promote *open-source* by giving a ⭐ to the <a href='https://github.com/gojasper/flash-diffusion' target='_blank'>Github Repo</a>."
113
+ )
114
+ gr.Markdown(
115
+ "💡 *Hint:* To better appreciate the low latency of our method, run the demo locally !"
116
+ )
117
+
118
+ with gr.Row():
119
+ prompt = gr.Text(
120
+ label="Prompt",
121
+ show_label=False,
122
+ max_lines=1,
123
+ placeholder="Enter your prompt",
124
+ container=False,
125
+ )
126
+
127
+ run_button = gr.Button("Run", scale=0)
128
+
129
+ with gr.Accordion("Advanced Settings", open=False):
130
+ seed = gr.Slider(
131
+ label="Seed",
132
+ minimum=0,
133
+ maximum=MAX_SEED,
134
+ step=1,
135
+ value=0,
136
+ )
137
+
138
+ randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
139
+
140
+ examples = gr.Examples(examples=examples, inputs=[prompt])
141
+
142
+ gr.Markdown("**Disclaimer:**")
143
+ gr.Markdown(
144
+ "This demo is only for research purpose. Jasper cannot be held responsible for the generation of NSFW (Not Safe For Work) content through the use of this demo. Users are solely responsible for any content they create, and it is their obligation to ensure that it adheres to appropriate and ethical standards. Jasper provides the tools, but the responsibility for their use lies with the individual user."
145
+ )
146
+
147
+ result = gr.Image(label="Result", show_label=False)
148
+
149
+
150
+
151
  gr.on(
152
  [run_button.click, seed.change, randomize_seed.change, prompt.submit],
153
  fn=infer,