Spaces:
aiqtech
/
Running on Zero

dn6 HF staff multimodalart HF staff commited on
Commit
95554d6
1 Parent(s): bf94d78

UI suggestions (#1)

Browse files

- UI suggestions (ebfc6ec41b43646f2131766ac1ce56e973f0bea7)
- Update app.py (f45b4488b9b4cd3c2d936d17496afc95040535e2)


Co-authored-by: Apolinário from multimodal AI art <multimodalart@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +31 -29
app.py CHANGED
@@ -51,7 +51,7 @@ def predict(prompt, seed=42, randomize_seed=False, guidance_scale=5.0, num_infer
51
  width=WIDTH
52
  ).images[0]
53
 
54
- return export_to_gif(split_image(image, 4), "flux.gif", fps=4), seed
55
 
56
  demo = gr.Interface(fn=predict, inputs="text", outputs="image")
57
 
@@ -60,6 +60,7 @@ css="""
60
  margin: 0 auto;
61
  max-width: 520px;
62
  }
 
63
  """
64
  examples = [
65
  "a cat waving its paws in the air",
@@ -69,40 +70,15 @@ examples = [
69
 
70
  with gr.Blocks(css=css) as demo:
71
  with gr.Column(elem_id="col-container"):
 
72
  gr.Markdown("Create GIFs with Flux-dev. Based on @fofr's [tweet](https://x.com/fofrAI/status/1828910395962343561).")
73
  gr.Markdown("For better results include a description of the motion in your prompt")
74
  with gr.Row():
75
  prompt = gr.Text(label="Prompt", show_label=False, max_lines=1, placeholder="Enter your prompt")
76
  submit = gr.Button("Submit", scale=0)
77
 
78
- with gr.Accordion("Advanced Settings", open=False):
79
- seed = gr.Slider(
80
- label="Seed",
81
- minimum=0,
82
- maximum=MAX_SEED,
83
- step=1,
84
- value=0,
85
- )
86
-
87
- randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
88
-
89
- with gr.Row():
90
- guidance_scale = gr.Slider(
91
- label="Guidance Scale",
92
- minimum=1,
93
- maximum=15,
94
- step=0.1,
95
- value=3.5,
96
- )
97
- num_inference_steps = gr.Slider(
98
- label="Number of inference steps",
99
- minimum=1,
100
- maximum=50,
101
- step=1,
102
- value=28,
103
- )
104
-
105
  output = gr.Image(label="GIF", show_label=False)
 
106
  gr.Examples(
107
  examples=examples,
108
  fn=predict,
@@ -110,12 +86,38 @@ with gr.Blocks(css=css) as demo:
110
  outputs=[output, seed],
111
  cache_examples="lazy"
112
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
 
114
  gr.on(
115
  triggers=[submit.click, prompt.submit],
116
  fn=predict,
117
  inputs=[prompt, seed, randomize_seed, guidance_scale, num_inference_steps],
118
- outputs = [output, seed]
119
  )
120
 
121
  demo.launch()
 
51
  width=WIDTH
52
  ).images[0]
53
 
54
+ return export_to_gif(split_image(image, 4), "flux.gif", fps=4), output_stills, seed
55
 
56
  demo = gr.Interface(fn=predict, inputs="text", outputs="image")
57
 
 
60
  margin: 0 auto;
61
  max-width: 520px;
62
  }
63
+ #stills{max-height:160px}
64
  """
65
  examples = [
66
  "a cat waving its paws in the air",
 
70
 
71
  with gr.Blocks(css=css) as demo:
72
  with gr.Column(elem_id="col-container"):
73
+ gr.Markdown("# FLUX Gif Generator")
74
  gr.Markdown("Create GIFs with Flux-dev. Based on @fofr's [tweet](https://x.com/fofrAI/status/1828910395962343561).")
75
  gr.Markdown("For better results include a description of the motion in your prompt")
76
  with gr.Row():
77
  prompt = gr.Text(label="Prompt", show_label=False, max_lines=1, placeholder="Enter your prompt")
78
  submit = gr.Button("Submit", scale=0)
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  output = gr.Image(label="GIF", show_label=False)
81
+ output_stills = gr.Image(label="stills", show_label=False, elem_id="stills")
82
  gr.Examples(
83
  examples=examples,
84
  fn=predict,
 
86
  outputs=[output, seed],
87
  cache_examples="lazy"
88
  )
89
+ with gr.Accordion("Advanced Settings", open=False):
90
+ seed = gr.Slider(
91
+ label="Seed",
92
+ minimum=0,
93
+ maximum=MAX_SEED,
94
+ step=1,
95
+ value=0,
96
+ )
97
+
98
+ randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
99
+
100
+ with gr.Row():
101
+ guidance_scale = gr.Slider(
102
+ label="Guidance Scale",
103
+ minimum=1,
104
+ maximum=15,
105
+ step=0.1,
106
+ value=3.5,
107
+ )
108
+ num_inference_steps = gr.Slider(
109
+ label="Number of inference steps",
110
+ minimum=1,
111
+ maximum=50,
112
+ step=1,
113
+ value=28,
114
+ )
115
 
116
  gr.on(
117
  triggers=[submit.click, prompt.submit],
118
  fn=predict,
119
  inputs=[prompt, seed, randomize_seed, guidance_scale, num_inference_steps],
120
+ outputs = [output, output_stills, seed]
121
  )
122
 
123
  demo.launch()