p3nguknight commited on
Commit
c947682
·
1 Parent(s): 9a3c7df

Invert image and text

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -61,10 +61,10 @@ def pixtral_inference(
61
  chat = [
62
  {
63
  "role": "user",
64
- "content": [
 
65
  {"type": "text", "content": text},
66
- ]
67
- + [{"type": "image", "url": image_to_base64(i[0])} for i in images],
68
  }
69
  ]
70
 
@@ -76,7 +76,7 @@ def pixtral_inference(
76
  return_tensors="pt",
77
  ).to(model.device)
78
  print("GENERATING")
79
- generate_ids = model.generate(**inputs, max_new_tokens=500)
80
  print("GENERATING DONE")
81
  print("BATCH DECODE")
82
  output = processor.batch_decode(
@@ -84,7 +84,7 @@ def pixtral_inference(
84
  )[0]
85
  print("BATCH DECODE DONE")
86
  print(output)
87
- result = output.text
88
  return result
89
 
90
 
 
61
  chat = [
62
  {
63
  "role": "user",
64
+ "content": [{"type": "image", "url": image_to_base64(i[0])} for i in images]
65
+ + [
66
  {"type": "text", "content": text},
67
+ ],
 
68
  }
69
  ]
70
 
 
76
  return_tensors="pt",
77
  ).to(model.device)
78
  print("GENERATING")
79
+ generate_ids = model.generate(**inputs, max_new_tokens=256)
80
  print("GENERATING DONE")
81
  print("BATCH DECODE")
82
  output = processor.batch_decode(
 
84
  )[0]
85
  print("BATCH DECODE DONE")
86
  print(output)
87
+ result = output
88
  return result
89
 
90