RanM commited on
Commit
1d0b035
·
verified ·
1 Parent(s): a97be70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -13,9 +13,10 @@ def generate_image(text, sentence_mapping, character_dict, selected_style):
13
  try:
14
  prompt, _ = generate_prompt(text, sentence_mapping, character_dict, selected_style)
15
  print(f"Generated prompt: {prompt}")
16
- image = model(prompt=prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
 
 
17
  buffered = BytesIO()
18
- image.save(buffered, format="JPEG")
19
  image_bytes = buffered.getvalue()
20
  return image_bytes
21
  except Exception as e:
@@ -24,7 +25,7 @@ def generate_image(text, sentence_mapping, character_dict, selected_style):
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
 
 
13
  try:
14
  prompt, _ = generate_prompt(text, sentence_mapping, character_dict, selected_style)
15
  print(f"Generated prompt: {prompt}")
16
+ output = model(prompt=prompt, num_inference_steps=1, guidance_scale=0.0)
17
+ print(f"Model output: {output}")
18
+ image = output.images[0]
19
  buffered = BytesIO()
 
20
  image_bytes = buffered.getvalue()
21
  return image_bytes
22
  except Exception as e:
 
25
 
26
  def inference(sentence_mapping, character_dict, selected_style):
27
  images = {}
28
+ print(f'sentence_mapping: {sentence_mapping}, character_dict: {character_dict}, selected_style: {selected_style}')
29
  # Here we assume `sentence_mapping` is a dictionary where keys are paragraph numbers and values are lists of sentences
30
  grouped_sentences = sentence_mapping
31