Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -128,7 +128,7 @@ def enhance_prompt(google_api_key, prompt, style):
|
|
| 128 |
logging.error(f"Error in enhance_prompt: {str(e)}")
|
| 129 |
raise
|
| 130 |
|
| 131 |
-
def generate_image(stability_api_key, enhanced_prompt, style, negative_prompt, cfg_scale, steps, aspect_ratio):
|
| 132 |
url = "https://api.stability.ai/v2beta/stable-image/generate/sd3"
|
| 133 |
|
| 134 |
headers = {
|
|
@@ -141,8 +141,6 @@ def generate_image(stability_api_key, enhanced_prompt, style, negative_prompt, c
|
|
| 141 |
"negative_prompt": negative_prompt,
|
| 142 |
"model": "sd3.5-large-turbo",
|
| 143 |
"output_format": "jpeg",
|
| 144 |
-
"width": 1024,
|
| 145 |
-
"height": 1024,
|
| 146 |
"num_images": 1,
|
| 147 |
"steps": steps,
|
| 148 |
"cfg_scale": cfg_scale,
|
|
@@ -209,6 +207,7 @@ def process_and_generate(google_api_key, stability_api_key, prompt, style, cfg_s
|
|
| 209 |
State("aspect-ratio", "value")],
|
| 210 |
prevent_initial_call=True
|
| 211 |
)
|
|
|
|
| 212 |
def update_output(n_clicks, google_api_key, stability_api_key, prompt, style, cfg_scale, steps, aspect_ratio):
|
| 213 |
if n_clicks is None:
|
| 214 |
raise PreventUpdate
|
|
|
|
| 128 |
logging.error(f"Error in enhance_prompt: {str(e)}")
|
| 129 |
raise
|
| 130 |
|
| 131 |
+
def generate_image(stability_api_key, enhanced_prompt, style, negative_prompt, cfg_scale=7, steps=30, aspect_ratio="1:1"):
|
| 132 |
url = "https://api.stability.ai/v2beta/stable-image/generate/sd3"
|
| 133 |
|
| 134 |
headers = {
|
|
|
|
| 141 |
"negative_prompt": negative_prompt,
|
| 142 |
"model": "sd3.5-large-turbo",
|
| 143 |
"output_format": "jpeg",
|
|
|
|
|
|
|
| 144 |
"num_images": 1,
|
| 145 |
"steps": steps,
|
| 146 |
"cfg_scale": cfg_scale,
|
|
|
|
| 207 |
State("aspect-ratio", "value")],
|
| 208 |
prevent_initial_call=True
|
| 209 |
)
|
| 210 |
+
|
| 211 |
def update_output(n_clicks, google_api_key, stability_api_key, prompt, style, cfg_scale, steps, aspect_ratio):
|
| 212 |
if n_clicks is None:
|
| 213 |
raise PreventUpdate
|