MaxMilan1
commited on
Commit
·
4095388
1
Parent(s):
92ecdcd
more final changes??
Browse files
app.py
CHANGED
@@ -4,21 +4,19 @@ import torch
|
|
4 |
from diffusers import DiffusionPipeline
|
5 |
import rembg
|
6 |
|
7 |
-
model_id = "
|
8 |
pipe = DiffusionPipeline.from_pretrained(model_id,
|
9 |
torch_dtype=torch.float16,
|
10 |
-
use_safetensors=True,
|
11 |
-
|
12 |
-
pipe.load_lora_weights("CiroN2022/shoes", weight_name="shoes.safetensors", adapter_name="shoes")
|
13 |
-
pipe.set_adapters("shoes")
|
14 |
|
15 |
pipe.to("cuda")
|
16 |
|
17 |
# Function to generate an image from text using diffusion
|
18 |
@spaces.GPU
|
19 |
-
def generate_image(prompt):
|
20 |
-
|
21 |
-
image = pipe(prompt)
|
22 |
image2 = rembg.remove(image)
|
23 |
return image, image2
|
24 |
|
@@ -26,7 +24,7 @@ _TITLE = "Shoe Generator"
|
|
26 |
with gr.Blocks(_TITLE) as ShoeGen:
|
27 |
with gr.Row():
|
28 |
with gr.Column():
|
29 |
-
prompt = gr.Textbox(label="Enter a
|
30 |
neg_prompt = gr.Textbox(label="Enter a negative prompt", value="low quality, watermark, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, body out of frame, blurry, bad anatomy, blurred, watermark, grainy, signature, cut off, draft, closed eyes, text, logo")
|
31 |
button_gen = gr.Button("Generate Image")
|
32 |
with gr.Column():
|
|
|
4 |
from diffusers import DiffusionPipeline
|
5 |
import rembg
|
6 |
|
7 |
+
model_id = "dataautogpt3/OpenDalleV1.1"
|
8 |
pipe = DiffusionPipeline.from_pretrained(model_id,
|
9 |
torch_dtype=torch.float16,
|
10 |
+
use_safetensors=True,
|
11 |
+
variant="fp16")
|
|
|
|
|
12 |
|
13 |
pipe.to("cuda")
|
14 |
|
15 |
# Function to generate an image from text using diffusion
|
16 |
@spaces.GPU
|
17 |
+
def generate_image(prompt, neg_prompt):
|
18 |
+
prompt += "no background, side view, minimalist shot"
|
19 |
+
image = pipe(prompt, negative_prompt=neg_prompt, output_type="pil")
|
20 |
image2 = rembg.remove(image)
|
21 |
return image, image2
|
22 |
|
|
|
24 |
with gr.Blocks(_TITLE) as ShoeGen:
|
25 |
with gr.Row():
|
26 |
with gr.Column():
|
27 |
+
prompt = gr.Textbox(label="Enter a discription of a shoe", value="no background, side view, minimalist shot")
|
28 |
neg_prompt = gr.Textbox(label="Enter a negative prompt", value="low quality, watermark, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, body out of frame, blurry, bad anatomy, blurred, watermark, grainy, signature, cut off, draft, closed eyes, text, logo")
|
29 |
button_gen = gr.Button("Generate Image")
|
30 |
with gr.Column():
|