Spaces:
Running
Running
halimbahae
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -16,9 +16,32 @@ else:
|
|
16 |
pipe = pipe.to(device)
|
17 |
|
18 |
MAX_SEED = np.iinfo(np.int32).max
|
19 |
-
MAX_IMAGE_SIZE =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
|
|
|
|
22 |
|
23 |
if randomize_seed:
|
24 |
seed = random.randint(0, MAX_SEED)
|
@@ -26,7 +49,7 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
26 |
generator = torch.Generator().manual_seed(seed)
|
27 |
|
28 |
image = pipe(
|
29 |
-
prompt =
|
30 |
negative_prompt = negative_prompt,
|
31 |
guidance_scale = guidance_scale,
|
32 |
num_inference_steps = num_inference_steps,
|
@@ -37,6 +60,9 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
37 |
|
38 |
return image
|
39 |
|
|
|
|
|
|
|
40 |
examples = [
|
41 |
"Sunset over the Atlas Mountains",
|
42 |
"Traditional Amazigh jewelry under the moonlight",
|
|
|
16 |
pipe = pipe.to(device)
|
17 |
|
18 |
MAX_SEED = np.iinfo(np.int32).max
|
19 |
+
MAX_IMAGE_SIZE = 3072
|
20 |
+
|
21 |
+
# def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
22 |
+
|
23 |
+
# if randomize_seed:
|
24 |
+
# seed = random.randint(0, MAX_SEED)
|
25 |
+
|
26 |
+
# generator = torch.Generator().manual_seed(seed)
|
27 |
+
|
28 |
+
# image = pipe(
|
29 |
+
# prompt = prompt,
|
30 |
+
# negative_prompt = negative_prompt,
|
31 |
+
# guidance_scale = guidance_scale,
|
32 |
+
# num_inference_steps = num_inference_steps,
|
33 |
+
# width = width,
|
34 |
+
# height = height,
|
35 |
+
# generator = generator
|
36 |
+
# ).images[0]
|
37 |
+
|
38 |
+
# return image
|
39 |
+
|
40 |
+
|
41 |
|
42 |
def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
43 |
+
# Append Moroccan and Amazigh art styles to the prompt
|
44 |
+
style_prompt = f"{prompt}, inspired by Moroccan and Amazigh arts, traditional motifs, vibrant colors, and intricate patterns."
|
45 |
|
46 |
if randomize_seed:
|
47 |
seed = random.randint(0, MAX_SEED)
|
|
|
49 |
generator = torch.Generator().manual_seed(seed)
|
50 |
|
51 |
image = pipe(
|
52 |
+
prompt = style_prompt,
|
53 |
negative_prompt = negative_prompt,
|
54 |
guidance_scale = guidance_scale,
|
55 |
num_inference_steps = num_inference_steps,
|
|
|
60 |
|
61 |
return image
|
62 |
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
examples = [
|
67 |
"Sunset over the Atlas Mountains",
|
68 |
"Traditional Amazigh jewelry under the moonlight",
|