Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def generate_image(prompt):
|
|
22 |
print(f"Generating image with truncated prompt: {truncated_prompt}")
|
23 |
|
24 |
# Call the model
|
25 |
-
output = model(prompt=truncated_prompt, num_inference_steps=
|
26 |
|
27 |
# Check if output is valid
|
28 |
if output is not None and hasattr(output, 'images') and output.images:
|
@@ -54,15 +54,10 @@ def process_prompt(sentence_mapping, character_dict, selected_style):
|
|
54 |
print(f"Character Dict: {character_dict}")
|
55 |
print(f"Selected Style: {selected_style}")
|
56 |
|
57 |
-
|
58 |
for paragraph_number, sentences in sentence_mapping.items():
|
59 |
combined_sentence = " ".join(sentences)
|
60 |
-
prompt = generate_prompt(combined_sentence, sentence_mapping, character_dict, selected_style)
|
61 |
-
prompts.append((paragraph_number, prompt))
|
62 |
-
print(f"Generated prompt for paragraph {paragraph_number}: {prompt}")
|
63 |
-
|
64 |
-
images = {}
|
65 |
-
for paragraph_number, prompt in prompts:
|
66 |
img_str = inference(prompt)
|
67 |
images[paragraph_number] = img_str
|
68 |
|
|
|
22 |
print(f"Generating image with truncated prompt: {truncated_prompt}")
|
23 |
|
24 |
# Call the model
|
25 |
+
output = model(prompt=truncated_prompt, num_inference_steps=1, guidance_scale=0.0)
|
26 |
|
27 |
# Check if output is valid
|
28 |
if output is not None and hasattr(output, 'images') and output.images:
|
|
|
54 |
print(f"Character Dict: {character_dict}")
|
55 |
print(f"Selected Style: {selected_style}")
|
56 |
|
57 |
+
images = {}
|
58 |
for paragraph_number, sentences in sentence_mapping.items():
|
59 |
combined_sentence = " ".join(sentences)
|
60 |
+
prompt, _ = generate_prompt(combined_sentence, sentence_mapping, character_dict, selected_style)
|
|
|
|
|
|
|
|
|
|
|
61 |
img_str = inference(prompt)
|
62 |
images[paragraph_number] = img_str
|
63 |
|