Update project_model.py
Browse files- project_model.py +13 -5
project_model.py
CHANGED
|
@@ -203,11 +203,19 @@ def process_inputs(
|
|
| 203 |
session.add_question(question)
|
| 204 |
|
| 205 |
# Create the structured input for Gemma, including image, question, and visual context
|
| 206 |
-
gemma_input = {
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
}
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
# Process the input through Gemma
|
| 212 |
gemma_output = gemma_pipe(gemma_input)
|
| 213 |
|
|
|
|
| 203 |
session.add_question(question)
|
| 204 |
|
| 205 |
# Create the structured input for Gemma, including image, question, and visual context
|
| 206 |
+
#gemma_input = {
|
| 207 |
+
# "images": session.annotated_image, # Image context
|
| 208 |
+
# "text": question + " " + session.visual_context # Question and visual context combined as text
|
| 209 |
+
#}
|
| 210 |
+
|
| 211 |
+
gemma_input = [{
|
| 212 |
+
"role": "user",
|
| 213 |
+
"content": [
|
| 214 |
+
{"type": "image", "image": session.annotated_image}, # Image context
|
| 215 |
+
{"type": "text", "text": question + " " + session.visual_context} # Question and visual context combined as text
|
| 216 |
+
]
|
| 217 |
+
}]
|
| 218 |
+
|
| 219 |
# Process the input through Gemma
|
| 220 |
gemma_output = gemma_pipe(gemma_input)
|
| 221 |
|