avfranco commited on
Commit
51a331b
·
1 Parent(s): e3068fb

ea4all-gradio-agents-mcp-hackathon-tools-refactoring-vqa

Browse files
Files changed (1) hide show
  1. ea4all/ea4all_mcp.py +8 -6
ea4all/ea4all_mcp.py CHANGED
@@ -115,12 +115,14 @@ async def run_vqa_agentic_system(question: str, diagram: str, request: gr.Reques
115
 
116
  with Image.open(diagram) as diagram_:
117
  if diagram_.format not in allowed_file_types:
118
- chat_memory.append(ChatMessage(role="assistant", content="Invalid file type. Allowed file types are JPEG and PNG."))
119
- else:
120
- #'vqa_image = e4u.get_raw_image(diagram) #MOVED into Graph
121
- vqa_image = diagram
122
- response = await diagram_graph.ainvoke({"question":msg, "image": vqa_image}, config)
123
- chat_memory.append(ChatMessage(role="assistant", content=response['messages'][-1].content))
 
 
124
 
125
  yield chat_memory
126
 
 
115
 
116
  with Image.open(diagram) as diagram_:
117
  if diagram_.format not in allowed_file_types:
118
+ #chat_memory.append(ChatMessage(role="assistant", content="Invalid file type. Allowed file types are JPEG and PNG."))
119
+ print(f"---DIAGRAM: {diagram.format} is not a valid file type. Allowed file types are JPEG and PNG.---")
120
+ #else:
121
+ #'vqa_image = e4u.get_raw_image(diagram) #MOVED into Graph
122
+
123
+ vqa_image = diagram
124
+ response = await diagram_graph.ainvoke({"question":msg, "image": vqa_image}, config)
125
+ chat_memory.append(ChatMessage(role="assistant", content=response['messages'][-1].content))
126
 
127
  yield chat_memory
128