Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,28 +10,23 @@ model = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo")
|
|
10 |
|
11 |
async def generate_image(prompt):
|
12 |
try:
|
13 |
-
|
14 |
-
num_inference_steps = 3 # Adjust this value as needed
|
15 |
-
|
16 |
-
# Use the model to generate an image
|
17 |
output = await asyncio.to_thread(
|
18 |
model,
|
19 |
prompt=prompt,
|
20 |
-
num_inference_steps=num_inference_steps,
|
21 |
-
guidance_scale=0.0,
|
22 |
-
output_type="pil"
|
23 |
)
|
24 |
-
|
25 |
-
# Check for output validity and return
|
26 |
if output.images:
|
27 |
return output.images[0]
|
28 |
else:
|
29 |
raise Exception("No images returned by the model.")
|
30 |
-
|
31 |
except Exception as e:
|
32 |
print(f"Error generating image: {e}")
|
33 |
traceback.print_exc()
|
34 |
-
return None
|
|
|
35 |
|
36 |
async def inference(sentence_mapping, character_dict, selected_style):
|
37 |
images = []
|
|
|
10 |
|
11 |
async def generate_image(prompt):
|
12 |
try:
|
13 |
+
num_inference_steps = 4 # Increased inference steps
|
|
|
|
|
|
|
14 |
output = await asyncio.to_thread(
|
15 |
model,
|
16 |
prompt=prompt,
|
17 |
+
num_inference_steps=num_inference_steps,
|
18 |
+
guidance_scale=0.0,
|
19 |
+
output_type="pil"
|
20 |
)
|
|
|
|
|
21 |
if output.images:
|
22 |
return output.images[0]
|
23 |
else:
|
24 |
raise Exception("No images returned by the model.")
|
|
|
25 |
except Exception as e:
|
26 |
print(f"Error generating image: {e}")
|
27 |
traceback.print_exc()
|
28 |
+
return None
|
29 |
+
|
30 |
|
31 |
async def inference(sentence_mapping, character_dict, selected_style):
|
32 |
images = []
|