RanM commited on
Commit
b71021a
·
verified ·
1 Parent(s): 09e0158

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
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=50, guidance_scale=7.5)
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
- prompts = []
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