akhaliq HF Staff commited on
Commit
03d82a1
·
verified ·
1 Parent(s): 1a974b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -24,7 +24,6 @@ pipe.transformer.load_state_dict(state_dict)
24
  @spaces.GPU(duration=120)
25
  def generate_image(
26
  prompt,
27
- negative_prompt="",
28
  width=1024,
29
  height=1024,
30
  guidance_scale=3.5,
@@ -38,7 +37,6 @@ def generate_image(
38
 
39
  image = pipe(
40
  prompt=prompt,
41
- negative_prompt=negative_prompt if negative_prompt else None,
42
  guidance_scale=guidance_scale,
43
  height=height,
44
  width=width,
@@ -49,9 +47,9 @@ def generate_image(
49
 
50
  return image, seed
51
 
52
- with gr.Blocks(title="FLUX SRPO Text-to-Image") as demo:
53
- gr.Markdown("# FLUX with SRPO (Self-Regulating Preference Optimization)")
54
- gr.Markdown("Generate high-quality images using FLUX model enhanced with Tencent's SRPO technique")
55
 
56
  with gr.Row():
57
  with gr.Column(scale=3):
@@ -60,11 +58,6 @@ with gr.Blocks(title="FLUX SRPO Text-to-Image") as demo:
60
  placeholder="Describe the image you want to generate...",
61
  lines=3
62
  )
63
- negative_prompt = gr.Textbox(
64
- label="Negative Prompt (optional)",
65
- placeholder="What you don't want to see in the image...",
66
- lines=2
67
- )
68
 
69
  with gr.Row():
70
  width = gr.Slider(
@@ -124,7 +117,7 @@ with gr.Blocks(title="FLUX SRPO Text-to-Image") as demo:
124
 
125
  generate_btn.click(
126
  fn=generate_image,
127
- inputs=[prompt, negative_prompt, width, height, guidance_scale, num_inference_steps, seed],
128
  outputs=[output_image, used_seed]
129
  )
130
 
 
24
  @spaces.GPU(duration=120)
25
  def generate_image(
26
  prompt,
 
27
  width=1024,
28
  height=1024,
29
  guidance_scale=3.5,
 
37
 
38
  image = pipe(
39
  prompt=prompt,
 
40
  guidance_scale=guidance_scale,
41
  height=height,
42
  width=width,
 
47
 
48
  return image, seed
49
 
50
+ with gr.Blocks(title="FLUX SRPO Text-to-Image", theme=gr.themes.Soft(primary_hue="blue", secondary_hue="gray", neutral_hue="slate")) as demo:
51
+ gr.Markdown("# Flux SRPO")
52
+ gr.Markdown("Generate images using FLUX model enhanced with Tencent's SRPO technique")
53
 
54
  with gr.Row():
55
  with gr.Column(scale=3):
 
58
  placeholder="Describe the image you want to generate...",
59
  lines=3
60
  )
 
 
 
 
 
61
 
62
  with gr.Row():
63
  width = gr.Slider(
 
117
 
118
  generate_btn.click(
119
  fn=generate_image,
120
+ inputs=[prompt, width, height, guidance_scale, num_inference_steps, seed],
121
  outputs=[output_image, used_seed]
122
  )
123