Fiqa commited on
Commit
948eab4
·
verified ·
1 Parent(s): c6c4d1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -57,7 +57,7 @@ pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=
57
 
58
  device = "cuda" if torch.cuda.is_available() else "cpu"
59
  # pipe.to(device)
60
- model2.to(device)
61
  model.to(device)
62
  pipe.to(device)
63
 
@@ -110,7 +110,7 @@ def generate_caption_and_image(image, f, p, d):
110
  # return generated_image, generated_image1
111
  messages = [{"role": "user", "content": [{"type": "image"},{"type": "text", "text": "If I had to write a haiku for this one, it would be: "}]}]
112
  input_text = processor.apply_chat_template(messages, add_generation_prompt=True)
113
- inputs = processor(image,input_text,add_special_tokens=False,return_tensors="pt").to(model.device)
114
 
115
  output = model.generate(**inputs, max_new_tokens=30)
116
  caption =processor.decode(output[0])
 
57
 
58
  device = "cuda" if torch.cuda.is_available() else "cpu"
59
  # pipe.to(device)
60
+
61
  model.to(device)
62
  pipe.to(device)
63
 
 
110
  # return generated_image, generated_image1
111
  messages = [{"role": "user", "content": [{"type": "image"},{"type": "text", "text": "If I had to write a haiku for this one, it would be: "}]}]
112
  input_text = processor.apply_chat_template(messages, add_generation_prompt=True)
113
+ inputs = processor(image,input_text,add_special_tokens=False,return_tensors="pt").to(device)
114
 
115
  output = model.generate(**inputs, max_new_tokens=30)
116
  caption =processor.decode(output[0])