Spaces:
Sleeping
Sleeping
halimbahae
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -17,20 +17,17 @@ else:
|
|
17 |
|
18 |
MAX_SEED = np.iinfo(np.int32).max
|
19 |
|
20 |
-
def infer(prompt,
|
21 |
-
|
22 |
-
seed = random.randint(0, MAX_SEED)
|
23 |
-
|
24 |
generator = torch.Generator().manual_seed(seed)
|
25 |
|
26 |
image = pipe(
|
27 |
-
prompt
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
generator = generator
|
34 |
).images[0]
|
35 |
|
36 |
return image
|
@@ -40,6 +37,7 @@ examples = [
|
|
40 |
"Flying carpet in space",
|
41 |
"Unicorn riding a camel in the Sahara Desert",
|
42 |
"Moroccan souk floating in the sky",
|
|
|
43 |
]
|
44 |
|
45 |
css="""
|
@@ -68,8 +66,7 @@ with gr.Blocks(css=css) as demo:
|
|
68 |
""")
|
69 |
|
70 |
with gr.Row():
|
71 |
-
|
72 |
-
prompt = gr.Text(
|
73 |
label="Prompt",
|
74 |
show_label=False,
|
75 |
max_lines=1,
|
@@ -99,8 +96,8 @@ with gr.Blocks(css=css) as demo:
|
|
99 |
)
|
100 |
|
101 |
gr.Examples(
|
102 |
-
examples
|
103 |
-
inputs
|
104 |
)
|
105 |
|
106 |
gr.Markdown("""
|
@@ -110,9 +107,9 @@ with gr.Blocks(css=css) as demo:
|
|
110 |
""")
|
111 |
|
112 |
run_button.click(
|
113 |
-
fn
|
114 |
-
inputs
|
115 |
-
outputs
|
116 |
)
|
117 |
|
118 |
demo.queue().launch()
|
|
|
17 |
|
18 |
MAX_SEED = np.iinfo(np.int32).max
|
19 |
|
20 |
+
def infer(prompt, width, height):
|
21 |
+
seed = random.randint(0, MAX_SEED)
|
|
|
|
|
22 |
generator = torch.Generator().manual_seed(seed)
|
23 |
|
24 |
image = pipe(
|
25 |
+
prompt=prompt,
|
26 |
+
guidance_scale=7.5,
|
27 |
+
num_inference_steps=50,
|
28 |
+
width=width,
|
29 |
+
height=height,
|
30 |
+
generator=generator
|
|
|
31 |
).images[0]
|
32 |
|
33 |
return image
|
|
|
37 |
"Flying carpet in space",
|
38 |
"Unicorn riding a camel in the Sahara Desert",
|
39 |
"Moroccan souk floating in the sky",
|
40 |
+
"Traditional Amazigh jewelry under the moonlight"
|
41 |
]
|
42 |
|
43 |
css="""
|
|
|
66 |
""")
|
67 |
|
68 |
with gr.Row():
|
69 |
+
prompt = gr.Textbox(
|
|
|
70 |
label="Prompt",
|
71 |
show_label=False,
|
72 |
max_lines=1,
|
|
|
96 |
)
|
97 |
|
98 |
gr.Examples(
|
99 |
+
examples=examples,
|
100 |
+
inputs=[prompt]
|
101 |
)
|
102 |
|
103 |
gr.Markdown("""
|
|
|
107 |
""")
|
108 |
|
109 |
run_button.click(
|
110 |
+
fn=infer,
|
111 |
+
inputs=[prompt, width, height],
|
112 |
+
outputs=[result]
|
113 |
)
|
114 |
|
115 |
demo.queue().launch()
|