Spaces:
Runtime error
Runtime error
Jordan Legg
commited on
Commit
Β·
29a504c
1
Parent(s):
5b33905
log shape and error handling
Browse files
app.py
CHANGED
|
@@ -46,7 +46,7 @@ def infer(prompt, init_image=None, seed=42, randomize_seed=False, width=1024, he
|
|
| 46 |
print("No initial image provided, processing text2img")
|
| 47 |
# Process text2img
|
| 48 |
try:
|
| 49 |
-
print("Calling the diffusion pipeline
|
| 50 |
result = pipe(
|
| 51 |
prompt=prompt,
|
| 52 |
height=height,
|
|
@@ -56,10 +56,10 @@ def infer(prompt, init_image=None, seed=42, randomize_seed=False, width=1024, he
|
|
| 56 |
guidance_scale=0.0
|
| 57 |
)
|
| 58 |
image = result.images[0]
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
#
|
| 62 |
-
print(f"
|
| 63 |
except Exception as e:
|
| 64 |
print(f"Pipeline call failed with error: {e}")
|
| 65 |
raise
|
|
@@ -104,24 +104,23 @@ def infer(prompt, init_image=None, seed=42, randomize_seed=False, width=1024, he
|
|
| 104 |
raise
|
| 105 |
|
| 106 |
print("Calling the diffusion pipeline with latents")
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
print("Inference complete")
|
| 118 |
return image, seed
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
# Define example prompts
|
| 126 |
examples = [
|
| 127 |
"a tiny astronaut hatching from an egg on the moon",
|
|
|
|
| 46 |
print("No initial image provided, processing text2img")
|
| 47 |
# Process text2img
|
| 48 |
try:
|
| 49 |
+
print("Calling the diffusion pipeline for text2img")
|
| 50 |
result = pipe(
|
| 51 |
prompt=prompt,
|
| 52 |
height=height,
|
|
|
|
| 56 |
guidance_scale=0.0
|
| 57 |
)
|
| 58 |
image = result.images[0]
|
| 59 |
+
print(f"Generated image shape: {image.size}")
|
| 60 |
+
|
| 61 |
+
# Since the 'latents' attribute is not present, we need to inspect other attributes
|
| 62 |
+
print(f"Result attributes: {dir(result)}")
|
| 63 |
except Exception as e:
|
| 64 |
print(f"Pipeline call failed with error: {e}")
|
| 65 |
raise
|
|
|
|
| 104 |
raise
|
| 105 |
|
| 106 |
print("Calling the diffusion pipeline with latents")
|
| 107 |
+
try:
|
| 108 |
+
image = pipe(
|
| 109 |
+
prompt=prompt,
|
| 110 |
+
height=height,
|
| 111 |
+
width=width,
|
| 112 |
+
num_inference_steps=num_inference_steps,
|
| 113 |
+
generator=generator,
|
| 114 |
+
guidance_scale=0.0,
|
| 115 |
+
latents=latents
|
| 116 |
+
).images[0]
|
| 117 |
+
except Exception as e:
|
| 118 |
+
print(f"Pipeline call with latents failed with error: {e}")
|
| 119 |
+
raise
|
| 120 |
|
| 121 |
print("Inference complete")
|
| 122 |
return image, seed
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
# Define example prompts
|
| 125 |
examples = [
|
| 126 |
"a tiny astronaut hatching from an egg on the moon",
|