Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -447,6 +447,13 @@ def process_storybook_async(request_id, request_data):
|
|
| 447 |
print(f"๐ง Starting async processing for request: {request_id}")
|
| 448 |
print(f"๐ Pages to process: {len(request_data['scenes'])}")
|
| 449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
# Initial memory check
|
| 451 |
initial_memory = monitor_memory()
|
| 452 |
|
|
@@ -454,13 +461,13 @@ def process_storybook_async(request_id, request_data):
|
|
| 454 |
try:
|
| 455 |
print(f"๐ Processing page {i+1}/{len(request_data['scenes'])} for request {request_id}")
|
| 456 |
|
| 457 |
-
# Generate single page
|
| 458 |
image, status = generate_storybook_page(
|
| 459 |
scene['visual'],
|
| 460 |
request_data['story_title'],
|
| 461 |
i+1,
|
| 462 |
scene['text'],
|
| 463 |
-
|
| 464 |
request_data.get('model_choice', 'dreamshaper-8'),
|
| 465 |
request_data.get('style', 'childrens_book')
|
| 466 |
)
|
|
|
|
| 447 |
print(f"๐ง Starting async processing for request: {request_id}")
|
| 448 |
print(f"๐ Pages to process: {len(request_data['scenes'])}")
|
| 449 |
|
| 450 |
+
# Convert dictionary back to proper objects for character handling
|
| 451 |
+
characters = []
|
| 452 |
+
if 'characters' in request_data and request_data['characters']:
|
| 453 |
+
# Convert character dicts back to CharacterDescription objects
|
| 454 |
+
for char_dict in request_data['characters']:
|
| 455 |
+
characters.append(CharacterDescription(**char_dict))
|
| 456 |
+
|
| 457 |
# Initial memory check
|
| 458 |
initial_memory = monitor_memory()
|
| 459 |
|
|
|
|
| 461 |
try:
|
| 462 |
print(f"๐ Processing page {i+1}/{len(request_data['scenes'])} for request {request_id}")
|
| 463 |
|
| 464 |
+
# Generate single page - pass the converted character objects
|
| 465 |
image, status = generate_storybook_page(
|
| 466 |
scene['visual'],
|
| 467 |
request_data['story_title'],
|
| 468 |
i+1,
|
| 469 |
scene['text'],
|
| 470 |
+
characters, # Pass the converted objects, not raw dicts
|
| 471 |
request_data.get('model_choice', 'dreamshaper-8'),
|
| 472 |
request_data.get('style', 'childrens_book')
|
| 473 |
)
|