Rooni commited on
Commit
3d995e6
1 Parent(s): 6b7d962

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -14,7 +14,7 @@ models_list = ["AbsoluteReality 1.8.1", "DALL-E 3 XL", "Playground 2", "Openjour
14
 
15
  # PLEASE ❤ like ❤ this space. Please like me. I am 12 years old, one of my projects is: https://ai-hub.rf.gd . I live in Russia, I don't know English very well. Therefore, I apologize that there is only Russian here, but I think it will not be difficult to translate all this. (For example, using gpt)
16
 
17
- def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1):
18
  if prompt == "" or prompt == None:
19
  return None
20
 
@@ -76,7 +76,8 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
76
  "is_negative": is_negative,
77
  "steps": steps,
78
  "cfg_scale": cfg_scale,
79
- "seed": seed if seed != -1 else random.randint(1, 1000000000)
 
80
  }
81
 
82
  response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
@@ -119,6 +120,8 @@ with gr.Blocks(css=css) as dalle:
119
  cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
120
  with gr.Row():
121
  method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
 
 
122
  with gr.Row():
123
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
124
 
@@ -131,6 +134,6 @@ with gr.Blocks(css=css) as dalle:
131
  with gr.Row():
132
  image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
133
 
134
- text_button.click(query, inputs=[text_prompt, model, negative_prompt, steps, cfg, method, seed], outputs=image_output)
135
 
136
  dalle.launch(show_api=False, share=False)
 
14
 
15
  # PLEASE ❤ like ❤ this space. Please like me. I am 12 years old, one of my projects is: https://ai-hub.rf.gd . I live in Russia, I don't know English very well. Therefore, I apologize that there is only Russian here, but I think it will not be difficult to translate all this. (For example, using gpt)
16
 
17
+ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7):
18
  if prompt == "" or prompt == None:
19
  return None
20
 
 
76
  "is_negative": is_negative,
77
  "steps": steps,
78
  "cfg_scale": cfg_scale,
79
+ "seed": seed if seed != -1 else random.randint(1, 1000000000),
80
+ "strength": strength
81
  }
82
 
83
  response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
 
120
  cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
121
  with gr.Row():
122
  method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
123
+ with gr.Row():
124
+ strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
125
  with gr.Row():
126
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
127
 
 
134
  with gr.Row():
135
  image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
136
 
137
+ text_button.click(query, inputs=[text_prompt, model, negative_prompt, steps, cfg, method, seed, strength], outputs=image_output)
138
 
139
  dalle.launch(show_api=False, share=False)