Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,20 +78,19 @@ def generate_image(prompt):
|
|
| 78 |
"""Generates an image using the refined prompt."""
|
| 79 |
# truncated_prompt = truncate_prompt(prompt)
|
| 80 |
try:
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
# ).images[0]
|
| 91 |
except Exception as e:
|
| 92 |
# Optionally, handle errors (you can also return a default error image)
|
| 93 |
image = None
|
| 94 |
-
print(
|
| 95 |
return image
|
| 96 |
|
| 97 |
with gr.Blocks(css=".gradio-container {background-color: #f9f9f9; padding: 20px;}") as demo:
|
|
|
|
| 78 |
"""Generates an image using the refined prompt."""
|
| 79 |
# truncated_prompt = truncate_prompt(prompt)
|
| 80 |
try:
|
| 81 |
+
image = pipe(
|
| 82 |
+
prompt,
|
| 83 |
+
height=1024,
|
| 84 |
+
width=1024,
|
| 85 |
+
guidance_scale=3.5,
|
| 86 |
+
num_inference_steps=50,
|
| 87 |
+
max_sequence_length=512,
|
| 88 |
+
generator=torch.Generator("cpu").manual_seed(0)
|
| 89 |
+
).images[0]
|
|
|
|
| 90 |
except Exception as e:
|
| 91 |
# Optionally, handle errors (you can also return a default error image)
|
| 92 |
image = None
|
| 93 |
+
print(e)
|
| 94 |
return image
|
| 95 |
|
| 96 |
with gr.Blocks(css=".gradio-container {background-color: #f9f9f9; padding: 20px;}") as demo:
|