Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from PIL import Image
|
|
4 |
from diffusers import AutoPipelineForText2Image
|
5 |
import gradio as gr
|
6 |
import base64
|
7 |
-
|
8 |
|
9 |
CONCURRENCY_LIMIT = 10
|
10 |
|
@@ -54,13 +54,10 @@ def inference(sentence_mapping, character_dict, selected_style):
|
|
54 |
print(f"Received character_dict: {character_dict}, type: {type(character_dict)}")
|
55 |
print(f"Received selected_style: {selected_style}, type: {type(selected_style)}")
|
56 |
|
57 |
-
if sentence_mapping is None or character_dict is None or selected_style is None:
|
58 |
-
return {"error": "One or more inputs are None"}
|
59 |
-
|
60 |
images = {}
|
61 |
for paragraph_number, sentences in sentence_mapping.items():
|
62 |
combined_sentence = " ".join(sentences)
|
63 |
-
prompt =
|
64 |
print(f"Generated prompt for paragraph {paragraph_number}: {prompt}")
|
65 |
img_str, error = generate_image(prompt)
|
66 |
if error:
|
|
|
4 |
from diffusers import AutoPipelineForText2Image
|
5 |
import gradio as gr
|
6 |
import base64
|
7 |
+
from generate_prompts import generate_prompt
|
8 |
|
9 |
CONCURRENCY_LIMIT = 10
|
10 |
|
|
|
54 |
print(f"Received character_dict: {character_dict}, type: {type(character_dict)}")
|
55 |
print(f"Received selected_style: {selected_style}, type: {type(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,character_dict, selected_style)
|
61 |
print(f"Generated prompt for paragraph {paragraph_number}: {prompt}")
|
62 |
img_str, error = generate_image(prompt)
|
63 |
if error:
|