Back to default
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,
|
| 27 |
|
| 28 |
if randomize_seed:
|
| 29 |
seed = random.randint(0, MAX_SEED)
|
|
@@ -108,7 +108,7 @@ with gr.Blocks() as demo:
|
|
| 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,
|
| 112 |
outputs=[result, seed, latency],
|
| 113 |
show_progress="hidden",
|
| 114 |
show_api=False,
|
|
@@ -117,4 +117,4 @@ with gr.Blocks() as demo:
|
|
| 117 |
)
|
| 118 |
|
| 119 |
# Launch the app
|
| 120 |
-
demo.launch()
|
|
|
|
| 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=DEFAULT_INFERENCE_STEPS):
|
| 27 |
|
| 28 |
if randomize_seed:
|
| 29 |
seed = random.randint(0, MAX_SEED)
|
|
|
|
| 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],
|
| 113 |
show_progress="hidden",
|
| 114 |
show_api=False,
|
|
|
|
| 117 |
)
|
| 118 |
|
| 119 |
# Launch the app
|
| 120 |
+
demo.launch()
|