This repository includes a sample analysis_tool that:
- Reads a YOLO detection log file (
detections.txt). - Invokes a DeepSeek model via Ollama to analyze the log.
- Produces an email-style summary with the number of
Dangerdetections, a short explanation, an optional warning, and a mention of adetection_snapshot.png. - Writes the final output to
analysis.txt.
-
analysis_tool (defined in
deepseek_agent.py):- Loads the YOLO detections from a file.
- Sends a prompt to the DeepSeek model via Ollama.
- Parses the AI response, ensuring we have bullet lines for:
- Number of 'Danger' detections: X- Brief explanation: Y
- Adds some fallback text if the model doesn't provide them.
- Saves the final email-like text to
analysis.txt.
-
Mail Sending (Future Step):
- Another agent (or Python code) can read
analysis.txtand send it to the required email address.
- Another agent (or Python code) can read
- Python 3.8+
langchain-ollamafor ChatOllama- Ollama CLI or server running locally with your chosen model (e.g.
deepseek-r1:1.5b) - Additional packages as listed in
requirements.txt.
- Make sure you have Ollama installed and running locally.
- Pull the model:
ollama pull deepseek-r1:1.5b
ollama serve
from deepseek_agent import analysis_tool
result = analysis_tool('detections.txt') print(result)