multimodalart HF staff commited on
Commit
3d0c27d
1 Parent(s): dd73ce4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -9,7 +9,8 @@ from transformers import CLIPTextModel, CLIPTokenizer,T5EncoderModel, T5Tokenize
9
  dtype = torch.bfloat16
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
11
 
12
- pipe = DiffusionPipeline.from_pretrained("sayakpaul/FLUX.1-merged", torch_dtype=torch.bfloat16).to(device)
 
13
 
14
  MAX_SEED = np.iinfo(np.int32).max
15
  MAX_IMAGE_SIZE = 2048
@@ -45,9 +46,8 @@ css="""
45
  with gr.Blocks(css=css) as demo:
46
 
47
  with gr.Column(elem_id="col-container"):
48
- gr.Markdown(f"""# FLUX.1 [dev]
49
- 12B param rectified flow transformer guidance-distilled from [FLUX.1 [pro]](https://blackforestlabs.ai/)
50
- [[non-commercial license](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md)] [[blog](https://blackforestlabs.ai/announcing-black-forest-labs/)] [[model](https://huggingface.co/black-forest-labs/FLUX.1-dev)]
51
  """)
52
 
53
  with gr.Row():
@@ -59,7 +59,13 @@ with gr.Blocks(css=css) as demo:
59
  placeholder="Enter your prompt",
60
  container=False,
61
  )
62
-
 
 
 
 
 
 
63
  run_button = gr.Button("Run", scale=0)
64
 
65
  result = gr.Image(label="Result", show_label=False)
@@ -103,14 +109,6 @@ with gr.Blocks(css=css) as demo:
103
  step=0.1,
104
  value=3.5,
105
  )
106
-
107
- num_inference_steps = gr.Slider(
108
- label="Number of inference steps",
109
- minimum=1,
110
- maximum=50,
111
- step=1,
112
- value=8,
113
- )
114
 
115
  gr.Examples(
116
  examples = examples,
 
9
  dtype = torch.bfloat16
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
11
 
12
+ transformer = FluxTransformer2DModel.from_pretrained("sayakpaul/FLUX.1-merged", torch_dtype=dtype)
13
+ pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=dtype).to(device)
14
 
15
  MAX_SEED = np.iinfo(np.int32).max
16
  MAX_IMAGE_SIZE = 2048
 
46
  with gr.Blocks(css=css) as demo:
47
 
48
  with gr.Column(elem_id="col-container"):
49
+ gr.Markdown(f"""# FLUX.1 [merged]
50
+ Merge of the 12B param rectified flow transformers FLUX.1 [dev] and FLUX.1 [schnell], generate [dev] quality images with less steps!
 
51
  """)
52
 
53
  with gr.Row():
 
59
  placeholder="Enter your prompt",
60
  container=False,
61
  )
62
+ num_inference_steps = gr.Slider(
63
+ label="Number of inference steps",
64
+ minimum=1,
65
+ maximum=50,
66
+ step=1,
67
+ value=8,
68
+ )
69
  run_button = gr.Button("Run", scale=0)
70
 
71
  result = gr.Image(label="Result", show_label=False)
 
109
  step=0.1,
110
  value=3.5,
111
  )
 
 
 
 
 
 
 
 
112
 
113
  gr.Examples(
114
  examples = examples,