mrcuddle commited on
Commit
6889bb8
Β·
verified Β·
1 Parent(s): a1c5755

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -4,6 +4,7 @@ from PIL import Image
4
  import torch
5
  import numpy as np
6
  import spaces
 
7
  # Load the Pixtral model and processor
8
  model_id = "mrcuddle/lumimaid-v0.2-8b-pixtral"
9
  processor = AutoProcessor.from_pretrained(model_id)
@@ -25,8 +26,11 @@ def generate_text(input_text="", image=None):
25
  # Prepare inputs
26
  inputs = processor(text=input_text, images=image_pil, return_tensors="pt").to("cuda")
27
 
 
 
 
28
  # Check if image tokens are generated
29
- if 'image_token' not in inputs or inputs['image_token'].numel() == 0:
30
  return "Error: No image tokens generated. Please check the image and try again."
31
 
32
  # Generate output
 
4
  import torch
5
  import numpy as np
6
  import spaces
7
+
8
  # Load the Pixtral model and processor
9
  model_id = "mrcuddle/lumimaid-v0.2-8b-pixtral"
10
  processor = AutoProcessor.from_pretrained(model_id)
 
26
  # Prepare inputs
27
  inputs = processor(text=input_text, images=image_pil, return_tensors="pt").to("cuda")
28
 
29
+ # Debug: Print the keys of the inputs dictionary
30
+ print("Processor output keys:", inputs.keys())
31
+
32
  # Check if image tokens are generated
33
+ if 'input_ids' not in inputs or inputs['input_ids'].numel() == 0:
34
  return "Error: No image tokens generated. Please check the image and try again."
35
 
36
  # Generate output