Update app.py
Browse files
app.py
CHANGED
@@ -20,18 +20,18 @@ pipe = pipe.to(device)
|
|
20 |
|
21 |
|
22 |
# Funzione per generare un'immagine
|
23 |
-
def generate_image(prompt, neg_prompt, seed, steps):
|
24 |
generator = torch.manual_seed(seed)
|
25 |
start_time = time.time()
|
26 |
-
image = pipe(prompt, height=
|
27 |
end_time = time.time()
|
28 |
elapsed_time = end_time - start_time
|
29 |
return image, elapsed_time
|
30 |
|
31 |
demo = gr.Interface(
|
32 |
fn=generate_image,
|
33 |
-
inputs=["text","text", "slider", "slider"],
|
34 |
-
outputs=[gr.Image(),"
|
35 |
)
|
36 |
|
37 |
demo.launch()
|
|
|
20 |
|
21 |
|
22 |
# Funzione per generare un'immagine
|
23 |
+
def generate_image(prompt, neg_prompt, width=resolution[0], height=resolution[1], seed, steps):
|
24 |
generator = torch.manual_seed(seed)
|
25 |
start_time = time.time()
|
26 |
+
image = pipe(prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=guidance_scale, generator=generator, negative_prompt=neg_prompt).images[0]
|
27 |
end_time = time.time()
|
28 |
elapsed_time = end_time - start_time
|
29 |
return image, elapsed_time
|
30 |
|
31 |
demo = gr.Interface(
|
32 |
fn=generate_image,
|
33 |
+
inputs=["text","text","number","number", "slider", "slider"],
|
34 |
+
outputs=[gr.Image(),gr.Textbox(label="Elapsed time (seconds)")],
|
35 |
)
|
36 |
|
37 |
demo.launch()
|