islasher commited on
Commit
d2abec1
·
verified ·
1 Parent(s): 5f834b8

Update ImageGenerator.py

Browse files
Files changed (1) hide show
  1. ImageGenerator.py +24 -2
ImageGenerator.py CHANGED
@@ -158,8 +158,30 @@ def extract_assistant_response(decoded_text):
158
  import torch
159
  from diffusers import FluxPipeline
160
 
161
- pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
162
- pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  def generate_image(prompt):
164
  print('GENERATING IMAGE')
165
  prompt =extract_assistant_response(prompt)# "A cat holding a sign that says hello world"
 
158
  import torch
159
  from diffusers import FluxPipeline
160
 
161
+ # pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
162
+ # pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
163
+ # def generate_image(prompt):
164
+ # print('GENERATING IMAGE')
165
+ # prompt =extract_assistant_response(prompt)# "A cat holding a sign that says hello world"
166
+ # image = pipe(
167
+ # prompt,
168
+ # height=1024,
169
+ # width=1024,
170
+ # guidance_scale=3.5,
171
+ # num_inference_steps=50,
172
+ # max_sequence_length=512,
173
+ # generator=torch.Generator("cpu").manual_seed(0)
174
+ # ).images[0]
175
+ # #image.save("flux-dev.png")
176
+ # return image
177
+
178
+
179
+ from diffusers import DiffusionPipeline
180
+ import torch
181
+
182
+ pipeline = DiffusionPipeline.from_pretrained("segmind/tiny-sd", torch_dtype=torch.float16)
183
+ # prompt = "Portrait of a pretty girl"
184
+ # image = pipeline(prompt).images[0]
185
  def generate_image(prompt):
186
  print('GENERATING IMAGE')
187
  prompt =extract_assistant_response(prompt)# "A cat holding a sign that says hello world"