louiecerv commited on
Commit
970c52b
Β·
1 Parent(s): 09902f4
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -62,10 +62,15 @@ def extract_text_and_images(file_path):
62
  def generate_ai_response(text_content, image_urls, text_prompt):
63
  try:
64
  if image_urls:
65
- messages = [
66
- {"role": "user", "content": ["type": "text": f"Perform the task {text_prompt} on the provided images)",
67
- *[{"type": "image_url", "image_url": {"url": url}} for url in image_urls]]}
 
 
 
68
  ]
 
 
69
 
70
  else:
71
  messages = [{"role": "user", "content": f"{text_prompt} Analyze the text: {text_content}"}]
 
62
  def generate_ai_response(text_content, image_urls, text_prompt):
63
  try:
64
  if image_urls:
65
+ messages = [
66
+ {
67
+ "role": "user",
68
+ "content": [
69
+ {"type": "text", "text": text_prompt},
70
+ *[{"type": "image_url", "image_url": {"url": url}} for url in image_urls]
71
  ]
72
+ }
73
+ ]
74
 
75
  else:
76
  messages = [{"role": "user", "content": f"{text_prompt} Analyze the text: {text_content}"}]