Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -96,12 +96,12 @@ def latents_to_pil(latents):
|
|
96 |
return pil_images
|
97 |
|
98 |
|
99 |
-
def generate_with_embs(text_embeddings, text_input, seed):
|
100 |
|
101 |
height = 512 # default height of Stable Diffusion
|
102 |
width = 512 # default width of Stable Diffusion
|
103 |
-
num_inference_steps = 10 # Number of denoising steps
|
104 |
-
guidance_scale = 7.5 # Scale for classifier-free guidance
|
105 |
generator = torch.manual_seed(seed) # Seed generator to create the inital latent noise
|
106 |
batch_size = 1
|
107 |
|
@@ -291,12 +291,14 @@ dict_styles = {
|
|
291 |
'Oil Painting':'styles/learned_embeds_oil.bin',
|
292 |
}
|
293 |
|
294 |
-
def inference(prompt, style
|
295 |
|
296 |
if prompt is not None and style is not None and seed is not None:
|
297 |
style = dict_styles[style]
|
298 |
torch.manual_seed(seed)
|
299 |
-
|
|
|
|
|
300 |
return np.array(result)
|
301 |
else:
|
302 |
return None
|
|
|
96 |
return pil_images
|
97 |
|
98 |
|
99 |
+
def generate_with_embs(text_embeddings, text_input, seed,num_inference_steps,guidance_scale):
|
100 |
|
101 |
height = 512 # default height of Stable Diffusion
|
102 |
width = 512 # default width of Stable Diffusion
|
103 |
+
num_inference_steps = num_inference_steps # 10 # Number of denoising steps
|
104 |
+
guidance_scale = guidance_scale # 7.5 # Scale for classifier-free guidance
|
105 |
generator = torch.manual_seed(seed) # Seed generator to create the inital latent noise
|
106 |
batch_size = 1
|
107 |
|
|
|
291 |
'Oil Painting':'styles/learned_embeds_oil.bin',
|
292 |
}
|
293 |
|
294 |
+
def inference(prompt, seed, style):
|
295 |
|
296 |
if prompt is not None and style is not None and seed is not None:
|
297 |
style = dict_styles[style]
|
298 |
torch.manual_seed(seed)
|
299 |
+
num_inference_steps =10
|
300 |
+
guidance_scale =7.5
|
301 |
+
result = generate_with_prompt_style_guidance(prompt, style,seed,num_inference_steps,guidance_scale)
|
302 |
return np.array(result)
|
303 |
else:
|
304 |
return None
|