Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ DEFAULT_HEIGHT = 1024
|
|
26 |
DEFAULT_INFERENCE_STEPS = 1 # FLUX Schnell is designed for few steps
|
27 |
MIN_INFERENCE_STEPS = 1
|
28 |
MAX_INFERENCE_STEPS = 8 # Allow slightly more steps for potential quality boost
|
29 |
-
ENHANCE_STEPS =
|
30 |
|
31 |
# --- Device and Model Setup ---
|
32 |
dtype = torch.float16
|
@@ -87,7 +87,7 @@ except Exception as e:
|
|
87 |
|
88 |
# --- Inference Function ---
|
89 |
@spaces.GPU(duration=30) # Slightly increased duration buffer
|
90 |
-
def generate_image(prompt: str, seed: int = 42, width: int = DEFAULT_WIDTH, height: int = DEFAULT_HEIGHT, randomize_seed: bool = False, num_inference_steps: int =
|
91 |
"""Generates an image using the FLUX pipeline with error handling."""
|
92 |
|
93 |
if pipe is None:
|
@@ -214,7 +214,7 @@ with gr.Blocks() as demo:
|
|
214 |
with gr.Row():
|
215 |
width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=DEFAULT_WIDTH)
|
216 |
height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=DEFAULT_HEIGHT)
|
217 |
-
num_inference_steps = gr.Slider(label="Inference Steps", minimum=
|
218 |
|
219 |
with gr.Row():
|
220 |
gr.Markdown("### 🌟 Inspiration Gallery")
|
|
|
26 |
DEFAULT_INFERENCE_STEPS = 1 # FLUX Schnell is designed for few steps
|
27 |
MIN_INFERENCE_STEPS = 1
|
28 |
MAX_INFERENCE_STEPS = 8 # Allow slightly more steps for potential quality boost
|
29 |
+
ENHANCE_STEPS = 2 # Fixed steps for the enhance button
|
30 |
|
31 |
# --- Device and Model Setup ---
|
32 |
dtype = torch.float16
|
|
|
87 |
|
88 |
# --- Inference Function ---
|
89 |
@spaces.GPU(duration=30) # Slightly increased duration buffer
|
90 |
+
def generate_image(prompt: str, seed: int = 42, width: int = DEFAULT_WIDTH, height: int = DEFAULT_HEIGHT, randomize_seed: bool = False, num_inference_steps: int = 4, is_enhance: bool = False):
|
91 |
"""Generates an image using the FLUX pipeline with error handling."""
|
92 |
|
93 |
if pipe is None:
|
|
|
214 |
with gr.Row():
|
215 |
width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=DEFAULT_WIDTH)
|
216 |
height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=DEFAULT_HEIGHT)
|
217 |
+
num_inference_steps = gr.Slider(label="Inference Steps", minimum=MIN_INFERENCE_STEPS, maximum=MAX_INFERENCE_STEPS, step=1, value=DEFAULT_INFERENCE_STEPS)
|
218 |
|
219 |
with gr.Row():
|
220 |
gr.Markdown("### 🌟 Inspiration Gallery")
|