Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,9 +9,9 @@ from concurrent.futures import ThreadPoolExecutor
|
|
9 |
# Load the model once outside of the function
|
10 |
model = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo")
|
11 |
|
12 |
-
def generate_image(sentence_mapping, character_dict, selected_style):
|
13 |
try:
|
14 |
-
prompt, _ = generate_prompt(sentence_mapping, character_dict, selected_style)
|
15 |
image = model(prompt=prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
|
16 |
buffered = BytesIO()
|
17 |
img_str = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
@@ -22,8 +22,9 @@ def generate_image(sentence_mapping, character_dict, selected_style):
|
|
22 |
print(f"Error generating image: {e}")
|
23 |
return None
|
24 |
|
25 |
-
def inference(
|
26 |
images = {}
|
|
|
27 |
# Here we assume `sentence_mapping` is a dictionary where keys are paragraph numbers and values are lists of sentences
|
28 |
grouped_sentences = sentence_mapping
|
29 |
|
|
|
9 |
# Load the model once outside of the function
|
10 |
model = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo")
|
11 |
|
12 |
+
def generate_image(text, sentence_mapping, character_dict, selected_style):
|
13 |
try:
|
14 |
+
prompt, _ = generate_prompt(text, sentence_mapping, character_dict, selected_style)
|
15 |
image = model(prompt=prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
|
16 |
buffered = BytesIO()
|
17 |
img_str = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
|
|
22 |
print(f"Error generating image: {e}")
|
23 |
return None
|
24 |
|
25 |
+
def inference(sentence_mapping, character_dict, selected_style):
|
26 |
images = {}
|
27 |
+
print(f'sentence_mapping:{sentence_mapping}, character_dict:{character_dict}, selected_style:{selected_style}')
|
28 |
# Here we assume `sentence_mapping` is a dictionary where keys are paragraph numbers and values are lists of sentences
|
29 |
grouped_sentences = sentence_mapping
|
30 |
|