Update app.py
Browse files
app.py
CHANGED
|
@@ -42,7 +42,6 @@ def save_generated_image(image, prompt):
|
|
| 42 |
|
| 43 |
return filepath
|
| 44 |
|
| 45 |
-
# Fixed inference function - properly handle Progress parameter
|
| 46 |
@spaces.GPU(duration=60)
|
| 47 |
def inference(
|
| 48 |
prompt,
|
|
@@ -75,19 +74,6 @@ def inference(
|
|
| 75 |
# Return just the image and seed
|
| 76 |
return image, seed
|
| 77 |
|
| 78 |
-
# Create version for examples
|
| 79 |
-
def example_inference(prompt):
|
| 80 |
-
return inference(
|
| 81 |
-
prompt=prompt,
|
| 82 |
-
seed=42,
|
| 83 |
-
randomize_seed=True,
|
| 84 |
-
width=1024,
|
| 85 |
-
height=768,
|
| 86 |
-
guidance_scale=3.5,
|
| 87 |
-
num_inference_steps=30,
|
| 88 |
-
lora_scale=1.0
|
| 89 |
-
)
|
| 90 |
-
|
| 91 |
# Updated examples with 1880s clothing style
|
| 92 |
examples = [
|
| 93 |
"Cézanne's painting of a lively outdoor gathering in the 1880s, with men in formal top hats, frock coats, and women in bustled dresses with elaborate hats, enjoying a summer afternoon. The scene captures the Belle Époque atmosphere with dappled sunlight filtering through trees, highlighting the fashionable attire of the period. [trigger]",
|
|
@@ -98,9 +84,6 @@ examples = [
|
|
| 98 |
"Cézanne's depiction of bathers in 1880s swimming attire, showing the modest bathing costumes of the period. Women wear full-coverage dark bathing dresses with stockings, while men are in knee-length swimming suits. The figures are arranged in Cézanne's distinctive compositional style against a backdrop of water and landscape rendered in his bold color blocks. [trigger]"
|
| 99 |
]
|
| 100 |
|
| 101 |
-
# First example for preloading
|
| 102 |
-
default_prompt = examples[0]
|
| 103 |
-
|
| 104 |
# Improved custom CSS with better visuals
|
| 105 |
custom_css = """
|
| 106 |
:root {
|
|
@@ -190,11 +173,6 @@ button:hover {
|
|
| 190 |
}
|
| 191 |
"""
|
| 192 |
|
| 193 |
-
# Fixed preload function
|
| 194 |
-
def preload_example():
|
| 195 |
-
image, seed_value = inference(prompt=default_prompt)
|
| 196 |
-
return default_prompt, image, seed_value
|
| 197 |
-
|
| 198 |
with gr.Blocks(css=custom_css, analytics_enabled=False) as demo:
|
| 199 |
gr.HTML('<div class="title">Paul Cézanne STUDIO</div>')
|
| 200 |
|
|
@@ -212,6 +190,7 @@ with gr.Blocks(css=custom_css, analytics_enabled=False) as demo:
|
|
| 212 |
label="Prompt",
|
| 213 |
max_lines=1,
|
| 214 |
placeholder="Enter your prompt (add [trigger] at the end)",
|
|
|
|
| 215 |
)
|
| 216 |
run_button = gr.Button("Generate", variant="primary", scale=0)
|
| 217 |
|
|
@@ -272,9 +251,9 @@ with gr.Blocks(css=custom_css, analytics_enabled=False) as demo:
|
|
| 272 |
gr.Examples(
|
| 273 |
examples=examples,
|
| 274 |
inputs=prompt,
|
| 275 |
-
outputs=
|
| 276 |
-
fn=
|
| 277 |
-
cache_examples=
|
| 278 |
)
|
| 279 |
|
| 280 |
# Event handlers
|
|
@@ -294,12 +273,7 @@ with gr.Blocks(css=custom_css, analytics_enabled=False) as demo:
|
|
| 294 |
outputs=[result, seed_output],
|
| 295 |
)
|
| 296 |
|
| 297 |
-
#
|
| 298 |
-
demo.load(
|
| 299 |
-
fn=preload_example,
|
| 300 |
-
inputs=None,
|
| 301 |
-
outputs=[prompt, result, seed_output],
|
| 302 |
-
)
|
| 303 |
|
| 304 |
demo.queue()
|
| 305 |
demo.launch()
|
|
|
|
| 42 |
|
| 43 |
return filepath
|
| 44 |
|
|
|
|
| 45 |
@spaces.GPU(duration=60)
|
| 46 |
def inference(
|
| 47 |
prompt,
|
|
|
|
| 74 |
# Return just the image and seed
|
| 75 |
return image, seed
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
# Updated examples with 1880s clothing style
|
| 78 |
examples = [
|
| 79 |
"Cézanne's painting of a lively outdoor gathering in the 1880s, with men in formal top hats, frock coats, and women in bustled dresses with elaborate hats, enjoying a summer afternoon. The scene captures the Belle Époque atmosphere with dappled sunlight filtering through trees, highlighting the fashionable attire of the period. [trigger]",
|
|
|
|
| 84 |
"Cézanne's depiction of bathers in 1880s swimming attire, showing the modest bathing costumes of the period. Women wear full-coverage dark bathing dresses with stockings, while men are in knee-length swimming suits. The figures are arranged in Cézanne's distinctive compositional style against a backdrop of water and landscape rendered in his bold color blocks. [trigger]"
|
| 85 |
]
|
| 86 |
|
|
|
|
|
|
|
|
|
|
| 87 |
# Improved custom CSS with better visuals
|
| 88 |
custom_css = """
|
| 89 |
:root {
|
|
|
|
| 173 |
}
|
| 174 |
"""
|
| 175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
with gr.Blocks(css=custom_css, analytics_enabled=False) as demo:
|
| 177 |
gr.HTML('<div class="title">Paul Cézanne STUDIO</div>')
|
| 178 |
|
|
|
|
| 190 |
label="Prompt",
|
| 191 |
max_lines=1,
|
| 192 |
placeholder="Enter your prompt (add [trigger] at the end)",
|
| 193 |
+
value=examples[0] # Set default text instead of generating an image
|
| 194 |
)
|
| 195 |
run_button = gr.Button("Generate", variant="primary", scale=0)
|
| 196 |
|
|
|
|
| 251 |
gr.Examples(
|
| 252 |
examples=examples,
|
| 253 |
inputs=prompt,
|
| 254 |
+
outputs=None, # Don't auto-run examples
|
| 255 |
+
fn=None, # No function to run for examples - just fill the prompt
|
| 256 |
+
cache_examples=False, # Disable caching
|
| 257 |
)
|
| 258 |
|
| 259 |
# Event handlers
|
|
|
|
| 273 |
outputs=[result, seed_output],
|
| 274 |
)
|
| 275 |
|
| 276 |
+
# No preloading or automatic image generation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
|
| 278 |
demo.queue()
|
| 279 |
demo.launch()
|