Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ def get_image_size(aspect_ratio):
|
|
| 39 |
# Default to 1:1 if something goes wrong
|
| 40 |
return 664, 664
|
| 41 |
|
| 42 |
-
# --- Main Inference Function
|
| 43 |
@spaces.GPU(duration=30)
|
| 44 |
def generate_image(
|
| 45 |
prompt,
|
|
@@ -58,7 +58,7 @@ def generate_image(
|
|
| 58 |
prompt (str): Text description of the image to generate. Include: subject, style (e.g. photorealistic/anime/oil painting/watercolor/3D render), composition (e.g. close-up/wide shot/dynamic angle), lighting (e.g. soft/dramatic/backlit), colors (e.g. vibrant/muted/monochrome), mood (e.g. serene/dramatic/mysterious), setting. Specify text inquotes with position if needed. Keep under 200 words for best results.
|
| 59 |
"""
|
| 60 |
# Hardcode the negative prompt as requested
|
| 61 |
-
negative_prompt = "text, watermark, copyright, blurry, low resolution"
|
| 62 |
|
| 63 |
if randomize_seed:
|
| 64 |
seed = random.randint(0, MAX_SEED)
|
|
@@ -122,6 +122,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 122 |
placeholder="Enter your prompt",
|
| 123 |
container=False,
|
| 124 |
)
|
|
|
|
|
|
|
| 125 |
run_button = gr.Button("Run", scale=0, variant="primary")
|
| 126 |
|
| 127 |
result = gr.Image(label="Result", show_label=False, type="pil")
|
|
@@ -136,7 +138,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 136 |
step=1,
|
| 137 |
value=0,
|
| 138 |
)
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 141 |
|
| 142 |
with gr.Row():
|
|
@@ -171,7 +178,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 171 |
fn=generate_image,
|
| 172 |
inputs=[
|
| 173 |
prompt,
|
| 174 |
-
#
|
| 175 |
seed,
|
| 176 |
randomize_seed,
|
| 177 |
aspect_ratio,
|
|
|
|
| 39 |
# Default to 1:1 if something goes wrong
|
| 40 |
return 664, 664
|
| 41 |
|
| 42 |
+
# --- Main Inference Function ---
|
| 43 |
@spaces.GPU(duration=30)
|
| 44 |
def generate_image(
|
| 45 |
prompt,
|
|
|
|
| 58 |
prompt (str): Text description of the image to generate. Include: subject, style (e.g. photorealistic/anime/oil painting/watercolor/3D render), composition (e.g. close-up/wide shot/dynamic angle), lighting (e.g. soft/dramatic/backlit), colors (e.g. vibrant/muted/monochrome), mood (e.g. serene/dramatic/mysterious), setting. Specify text inquotes with position if needed. Keep under 200 words for best results.
|
| 59 |
"""
|
| 60 |
# Hardcode the negative prompt as requested
|
| 61 |
+
# negative_prompt = "text, watermark, copyright, blurry, low resolution"
|
| 62 |
|
| 63 |
if randomize_seed:
|
| 64 |
seed = random.randint(0, MAX_SEED)
|
|
|
|
| 122 |
placeholder="Enter your prompt",
|
| 123 |
container=False,
|
| 124 |
)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
run_button = gr.Button("Run", scale=0, variant="primary")
|
| 128 |
|
| 129 |
result = gr.Image(label="Result", show_label=False, type="pil")
|
|
|
|
| 138 |
step=1,
|
| 139 |
value=0,
|
| 140 |
)
|
| 141 |
+
|
| 142 |
+
negative_prompt = gr.Text(
|
| 143 |
+
label="Negative Prompt",
|
| 144 |
+
show_label=True,
|
| 145 |
+
placeholder="text, watermark, copyright, blurry, low resolution",
|
| 146 |
+
)
|
| 147 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 148 |
|
| 149 |
with gr.Row():
|
|
|
|
| 178 |
fn=generate_image,
|
| 179 |
inputs=[
|
| 180 |
prompt,
|
| 181 |
+
negative_prompt, # is no longer an input from the UI
|
| 182 |
seed,
|
| 183 |
randomize_seed,
|
| 184 |
aspect_ratio,
|