Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ torch.cuda.empty_cache()
|
|
| 23 |
|
| 24 |
# Inference function
|
| 25 |
@spaces.GPU(duration=25)
|
| 26 |
-
def generate_image(prompt, seed=42, width=DEFAULT_WIDTH, height=DEFAULT_HEIGHT, randomize_seed=False, num_inference_steps=
|
| 27 |
|
| 28 |
if randomize_seed:
|
| 29 |
seed = random.randint(0, MAX_SEED)
|
|
@@ -49,9 +49,9 @@ examples = [
|
|
| 49 |
"a tiny astronaut hatching from an egg on the moon",
|
| 50 |
"a cat holding a sign that says hello world",
|
| 51 |
"an anime illustration of a wiener schnitzel",
|
| 52 |
-
"a
|
|
|
|
| 53 |
"Photo of a young woman with long, wavy brown hair tied in a bun and glasses. She has a fair complexion and is wearing subtle makeup, emphasizing her eyes and lips. She is dressed in a black top. The background appears to be an urban setting with a building facade, and the sunlight casts a warm glow on her face.",
|
| 54 |
-
"Imagine steve jobs as Star Wars movie character"
|
| 55 |
]
|
| 56 |
|
| 57 |
# --- Gradio UI ---
|
|
@@ -106,7 +106,7 @@ with gr.Blocks() as demo:
|
|
| 106 |
)
|
| 107 |
|
| 108 |
gr.on(
|
| 109 |
-
triggers=[prompt.input, width.input, height.input, num_inference_steps.input],
|
| 110 |
fn=generate_image,
|
| 111 |
inputs=[prompt, seed, width, height, randomize_seed, num_inference_steps],
|
| 112 |
outputs=[result, seed, latency],
|
|
|
|
| 23 |
|
| 24 |
# Inference function
|
| 25 |
@spaces.GPU(duration=25)
|
| 26 |
+
def generate_image(prompt, seed=42, width=DEFAULT_WIDTH, height=DEFAULT_HEIGHT, randomize_seed=False, num_inference_steps=2):
|
| 27 |
|
| 28 |
if randomize_seed:
|
| 29 |
seed = random.randint(0, MAX_SEED)
|
|
|
|
| 49 |
"a tiny astronaut hatching from an egg on the moon",
|
| 50 |
"a cat holding a sign that says hello world",
|
| 51 |
"an anime illustration of a wiener schnitzel",
|
| 52 |
+
"a cute robot artist painting on an easel, concept art",
|
| 53 |
+
"Imagine steve jobs as Star Wars movie character",
|
| 54 |
"Photo of a young woman with long, wavy brown hair tied in a bun and glasses. She has a fair complexion and is wearing subtle makeup, emphasizing her eyes and lips. She is dressed in a black top. The background appears to be an urban setting with a building facade, and the sunlight casts a warm glow on her face.",
|
|
|
|
| 55 |
]
|
| 56 |
|
| 57 |
# --- Gradio UI ---
|
|
|
|
| 106 |
)
|
| 107 |
|
| 108 |
gr.on(
|
| 109 |
+
triggers=[prompt.submit, prompt.input, width.input, height.input, num_inference_steps.input],
|
| 110 |
fn=generate_image,
|
| 111 |
inputs=[prompt, seed, width, height, randomize_seed, num_inference_steps],
|
| 112 |
outputs=[result, seed, latency],
|