danilohssantana commited on
Commit
98d8559
·
1 Parent(s): 2044733

fixing parameters

Browse files
Files changed (2) hide show
  1. .DS_Store +0 -0
  2. main.py +14 -7
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
main.py CHANGED
@@ -118,21 +118,28 @@ def predict(data: PredictRequest):
118
  Generates a description for an image using the Qwen-2-VL model.
119
 
120
  Args:
121
- data (any): The encoded image and the prompt to be used.
122
- prompt (str): The text prompt to guide the model's response.
123
 
124
  Returns:
125
- str: The generated description of the image.
126
  """
127
 
128
- # Create the input message structure
 
 
 
 
 
 
 
129
  messages = [
130
  {
131
  "role": "user",
132
  "content": [
133
- {"type": "image", "image": f"data:image;base64,{data.image_base64}"},
134
- {"type": "text", "text": data.prompt},
135
- ],
 
136
  }
137
  ]
138
 
 
118
  Generates a description for an image using the Qwen-2-VL model.
119
 
120
  Args:
121
+ data (PredictRequest): The request containing encoded images and a prompt.
 
122
 
123
  Returns:
124
+ dict: The generated description of the image(s).
125
  """
126
 
127
+ # Ensure image_base64 is a list (even if a single image is provided)
128
+ image_list = (
129
+ data.image_base64
130
+ if isinstance(data.image_base64, list)
131
+ else [data.image_base64]
132
+ )
133
+
134
+ # Create the input message structure with multiple images
135
  messages = [
136
  {
137
  "role": "user",
138
  "content": [
139
+ {"type": "image", "image": f"data:image;base64,{image}"}
140
+ for image in image_list
141
+ ]
142
+ + [{"type": "text", "text": data.prompt}],
143
  }
144
  ]
145