MaxMilan1
commited on
Commit
·
fa0ee64
1
Parent(s):
6273843
app.py chang
Browse files
app.py
CHANGED
@@ -6,28 +6,23 @@ model_id = "Apocalypse-19/shoe-generator"
|
|
6 |
pipe = DiffusionPipeline.from_pretrained(model_id)
|
7 |
|
8 |
pipe.to("cuda")
|
9 |
-
# pipe.enable_xformers_memory_efficient_attention()
|
10 |
-
|
11 |
|
12 |
# Function to generate an image from text using diffusion
|
13 |
def generate_image(prompt):
|
14 |
|
15 |
-
images = pipe(prompt=prompt)
|
16 |
return images[0]
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
description = "Enter a text description of a shoe to generate an image of the shoe."
|
24 |
-
examples = [["A red shoe with white laces and black sole."], ["A blue sneaker with a white stripe."], ["A brown boot with a buckle."]]
|
25 |
|
26 |
-
|
27 |
-
fn=generate_image,
|
28 |
-
inputs=inputs,
|
29 |
-
outputs=outputs,
|
30 |
-
title=title,
|
31 |
-
description=description,
|
32 |
-
examples=examples
|
33 |
-
).launch()
|
|
|
6 |
pipe = DiffusionPipeline.from_pretrained(model_id)
|
7 |
|
8 |
pipe.to("cuda")
|
|
|
|
|
9 |
|
10 |
# Function to generate an image from text using diffusion
|
11 |
def generate_image(prompt):
|
12 |
|
13 |
+
images = pipe(prompt=prompt, negative_prompt=neg_prompt,)
|
14 |
return images[0]
|
15 |
|
16 |
+
_TITLE = "Shoe Generator"
|
17 |
+
with gr.Blocks(_TITLE) as ShoeGen:
|
18 |
+
with gr.Row():
|
19 |
+
with gr.Column():
|
20 |
+
prompt = gr.Textbox(lines=3, label="Enter a prompt")
|
21 |
+
neg_prompt = gr.Textbox(lines=3, label="Enter a negative prompt")
|
22 |
+
with gr.Column():
|
23 |
+
button_gen = gr.Button(label="Generate Image")
|
24 |
+
output = gr.Image(label="Generated Image")
|
25 |
|
26 |
+
button_gen.click(generate_image, inputs=[prompt, neg_prompt], outputs=output)
|
|
|
|
|
27 |
|
28 |
+
ShoeGen.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|