ovi054 commited on
Commit
61ebb83
1 Parent(s): 985b905

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -27,7 +27,7 @@ article_text = """
27
  </div>
28
  """
29
 
30
- def query(lora_id, prompt, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", seed=-1, width=1024, height=1024):
31
  if prompt == "" or prompt == None:
32
  return None
33
 
@@ -48,8 +48,8 @@ def query(lora_id, prompt, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", s
48
  # print(f'\033[1mGeneration {key}:\033[0m {prompt}')
49
 
50
  # If seed is -1, generate a random seed and use it
51
- if seed == -1:
52
- seed = random.randint(1, 1000000000)
53
 
54
  payload = {
55
  "inputs": prompt,
@@ -108,10 +108,12 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
108
  with gr.Row():
109
  width = gr.Slider(label="Width", value=1024, minimum=64, maximum=1216, step=8)
110
  height = gr.Slider(label="Height", value=1024, minimum=64, maximum=1216, step=8)
111
- steps = gr.Slider(label="Sampling steps", value=28, minimum=1, maximum=100, step=1)
112
- cfg = gr.Slider(label="CFG Scale", value=3.5, minimum=1, maximum=20, step=0.5)
113
- method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
114
- seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
 
 
115
 
116
  with gr.Row():
117
  text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
@@ -128,6 +130,6 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
128
  )
129
 
130
 
131
- text_button.click(query, inputs=[custom_lora, text_prompt, steps, cfg, method, seed, width, height], outputs=[image_output,seed_output])
132
 
133
  app.launch(show_api=False, share=False)
 
27
  </div>
28
  """
29
 
30
+ def query(lora_id, prompt, steps=28, cfg_scale=3.5, randomize_seed=True, seed=-1, width=1024, height=1024):
31
  if prompt == "" or prompt == None:
32
  return None
33
 
 
48
  # print(f'\033[1mGeneration {key}:\033[0m {prompt}')
49
 
50
  # If seed is -1, generate a random seed and use it
51
+ if randomize_seed:
52
+ seed = random.randint(1, 4294967296)
53
 
54
  payload = {
55
  "inputs": prompt,
 
108
  with gr.Row():
109
  width = gr.Slider(label="Width", value=1024, minimum=64, maximum=1216, step=8)
110
  height = gr.Slider(label="Height", value=1024, minimum=64, maximum=1216, step=8)
111
+ seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=4294967296, step=1)
112
+ randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
113
+ with gr.Row():
114
+ steps = gr.Slider(label="Sampling steps", value=28, minimum=1, maximum=100, step=1)
115
+ cfg = gr.Slider(label="CFG Scale", value=3.5, minimum=1, maximum=20, step=0.5)
116
+ # method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
117
 
118
  with gr.Row():
119
  text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
 
130
  )
131
 
132
 
133
+ text_button.click(query, inputs=[custom_lora, text_prompt, steps, cfg, randomize_seed, seed, width, height], outputs=[image_output,seed_output])
134
 
135
  app.launch(show_api=False, share=False)