paulb34 commited on
Commit
ff548ac
·
verified ·
1 Parent(s): a2abc5c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -34
app.py CHANGED
@@ -90,44 +90,45 @@ examples = [
90
  with gr.Blocks(theme=theme, css=css) as app:
91
  # Add a title to the app
92
  gr.HTML("<center><h1>FLUX.1-Dev</h1></center>")
93
-
94
- # Container for all the UI elements
95
- with gr.Column(elem_id="app-container"):
96
- # Add a text input for the main prompt
97
- with gr.Row():
98
- with gr.Column(elem_id="prompt-container"):
99
  with gr.Row():
100
- text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=2, elem_id="prompt-text-input")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
- # Accordion for advanced settings
103
  with gr.Row():
104
- with gr.Accordion("Advanced Settings", open=False):
105
- negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="(deformed, distorted, disfigured), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, misspellings, typos", lines=3, elem_id="negative-prompt-text-input")
106
- with gr.Row():
107
- width = gr.Slider(label="Width", value=1024, minimum=64, maximum=1216, step=32)
108
- height = gr.Slider(label="Height", value=1024, minimum=64, maximum=1216, step=32)
109
- steps = gr.Slider(label="Sampling steps", value=35, minimum=1, maximum=100, step=1)
110
- cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
111
- strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
112
- seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1) # Setting the seed to -1 will make it random
113
- method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
114
-
115
- # Add a button to trigger the image generation
116
- with gr.Row():
117
- text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
118
-
119
- # Image output area to display the generated image
120
- with gr.Row():
121
- image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
122
-
123
- with gr.Row():
124
- gr.Examples(
125
- examples = examples,
126
- inputs = [text_prompt],
127
- )
128
 
129
- # Bind the button to the query function with the added width and height inputs
130
- text_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=image_output)
 
 
 
 
 
 
131
 
132
  app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parameters
133
  if __name__ == "__main__":
 
90
  with gr.Blocks(theme=theme, css=css) as app:
91
  # Add a title to the app
92
  gr.HTML("<center><h1>FLUX.1-Dev</h1></center>")
93
+ with gr.Tabs() as tabs:
94
+ with gr.TabItem("✍️ Text to Image 🖼", visible=True):
95
+ # Container for all the UI elements
96
+ with gr.Column(elem_id="app-container"):
97
+ # Add a text input for the main prompt
 
98
  with gr.Row():
99
+ with gr.Column(elem_id="prompt-container"):
100
+ with gr.Row():
101
+ text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=2, elem_id="prompt-text-input")
102
+
103
+ # Accordion for advanced settings
104
+ with gr.Row():
105
+ with gr.Accordion("Advanced Settings", open=False):
106
+ negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="(deformed, distorted, disfigured), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, misspellings, typos", lines=3, elem_id="negative-prompt-text-input")
107
+ with gr.Row():
108
+ width = gr.Slider(label="Width", value=1024, minimum=64, maximum=1216, step=32)
109
+ height = gr.Slider(label="Height", value=1024, minimum=64, maximum=1216, step=32)
110
+ steps = gr.Slider(label="Sampling steps", value=35, minimum=1, maximum=100, step=1)
111
+ cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
112
+ strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
113
+ seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1) # Setting the seed to -1 will make it random
114
+ method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ 2S a Karras", "DPM2 a Karras", "DPM2 Karras", "DPM++ SDE Karras", "DEIS", "LMS", "DPM Adaptive", "DPM++ 2M", "DPM2 Ancestral", "DPM++ S", "DPM++ SDE", "DDPM", "DPM Fast", "dpmpp_2s_ancestral", "Euler", "Euler CFG PP", "Euler a", "Euler Ancestral", "Euler+beta", "Heun", "Heun PP2", "DDIM", "LMS Karras", "PLMS", "UniPC", "UniPC BH2"])
115
+
116
+ # Add a button to trigger the image generation
117
+ with gr.Row():
118
+ text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
119
 
120
+ # Image output area to display the generated image
121
  with gr.Row():
122
+ image_output = gr.Image(type="pil", label="Image Output", share=False, elem_id="gallery")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
+ with gr.Row():
125
+ gr.Examples(
126
+ examples = examples,
127
+ inputs = [text_prompt],
128
+ )
129
+
130
+ # Bind the button to the query function with the added width and height inputs
131
+ text_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=image_output)
132
 
133
  app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parameters
134
  if __name__ == "__main__":