RoAr777 commited on
Commit
f3ef993
·
verified ·
1 Parent(s): ac8e64b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -130,7 +130,7 @@ agent = initialize_agent(
130
  def encode_image_to_base64(image_path):
131
  return pytesseract.image_to_string(Image.open(image_path))
132
  def chatbot_response(m,query):
133
-
134
  if query.get('files'):
135
  # Encode image to base64
136
  image_data=""
@@ -144,12 +144,13 @@ def chatbot_response(m,query):
144
 
145
  ]
146
  )
 
147
  else:
148
  # If no image, only pass the text
149
  message = HumanMessage(content=[{"type": "text", "text": query}])
150
 
151
  # Invoke the model with the multimodal message
152
- result = agent.invoke(prompt.format(m,message))
153
  response = result['output']
154
  intermediate_steps = result.get('intermediate_steps', [])
155
 
 
130
  def encode_image_to_base64(image_path):
131
  return pytesseract.image_to_string(Image.open(image_path))
132
  def chatbot_response(m,query):
133
+ k=query['text']
134
  if query.get('files'):
135
  # Encode image to base64
136
  image_data=""
 
144
 
145
  ]
146
  )
147
+ k+=" System :Image(s) was added to this prompt by this user. Text Extracted from this image (Some words may be misspelled ,Use your understanding ):"+image_data
148
  else:
149
  # If no image, only pass the text
150
  message = HumanMessage(content=[{"type": "text", "text": query}])
151
 
152
  # Invoke the model with the multimodal message
153
+ result = agent.invoke(prompt.format(m,k))
154
  response = result['output']
155
  intermediate_steps = result.get('intermediate_steps', [])
156