Update app.py
Browse files
app.py
CHANGED
@@ -13,19 +13,16 @@ from tqdm.auto import tqdm
|
|
13 |
import random
|
14 |
import gradio as gr
|
15 |
|
16 |
-
def
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
image = pipe(prompt, num_inference_steps=num_inference_steps,guidance_scale=guidance_scale).images[0]
|
22 |
-
images.append(image)
|
23 |
-
return images[0]
|
24 |
|
25 |
-
def gr_generate_images(prompt: str,
|
26 |
prompt = prompt + "sks style"
|
27 |
-
|
28 |
-
return
|
29 |
|
30 |
with gr.Blocks() as demo:
|
31 |
examples = [
|
@@ -90,10 +87,6 @@ with gr.Blocks() as demo:
|
|
90 |
height="50%", # Use the full view height
|
91 |
object_fit="scale-down" # Maintain aspect ratio without cropping
|
92 |
)
|
93 |
-
num_images_slider = 1
|
94 |
-
num_inference_steps_slider = 20
|
95 |
-
guidance_slider = 8
|
96 |
-
|
97 |
btn.click(gr_generate_images, [text], gallery)
|
98 |
gr.Examples(examples, inputs=[text])
|
99 |
gr.HTML(
|
|
|
13 |
import random
|
14 |
import gradio as gr
|
15 |
|
16 |
+
def generate_image(prompt, guidance_scale, num_inference_steps):
|
17 |
+
seed = random.randint(1, 10000)
|
18 |
+
torch.manual_seed(seed)
|
19 |
+
image = pipe(prompt, num_inference_steps=num_inference_steps,guidance_scale=guidance_scale).images[0]
|
20 |
+
return image
|
|
|
|
|
|
|
21 |
|
22 |
+
def gr_generate_images(prompt: str, num_inference = 20, guidance_scale = 8 ):
|
23 |
prompt = prompt + "sks style"
|
24 |
+
image = generate_image(prompt, guidance_scale, num_inference)
|
25 |
+
return image
|
26 |
|
27 |
with gr.Blocks() as demo:
|
28 |
examples = [
|
|
|
87 |
height="50%", # Use the full view height
|
88 |
object_fit="scale-down" # Maintain aspect ratio without cropping
|
89 |
)
|
|
|
|
|
|
|
|
|
90 |
btn.click(gr_generate_images, [text], gallery)
|
91 |
gr.Examples(examples, inputs=[text])
|
92 |
gr.HTML(
|