fix : files cleaned

This commit is contained in:
priyanshm07 2025-04-02 03:06:57 +05:30
parent a25e103189
commit f41c3582b9
4 changed files with 5 additions and 45 deletions

View file

@ -2,8 +2,6 @@ from agno.agent import Agent
from agno.team.team import Team
from agno.models.google import Gemini
from agno.tools.duckduckgo import DuckDuckGoTools
from PIL import Image
import easyocr
import os
# --- Therapist Agent ---
@ -22,7 +20,7 @@ def create_therapist_agent():
api_key=os.environ.get("GEMINI_API_KEY")
),
tools=[DuckDuckGoTools()],
add_datetime_to_instructions=True, # Add timestamp context
add_datetime_to_instructions=True,
show_tool_calls=True,
markdown=True
)
@ -43,7 +41,7 @@ def create_closure_agent():
api_key=os.environ.get("GEMINI_API_KEY")
),
tools=[DuckDuckGoTools()],
add_datetime_to_instructions=True, # Add timestamp context
add_datetime_to_instructions=True,
show_tool_calls=True,
markdown=True
)
@ -85,7 +83,6 @@ def create_honesty_agent():
"Include reasons why the user should move on, based on the situation.",
"Format the output clearly with a header: **Brutal Honesty**",
],
# model=Gemini(id="gemini-2.0-flash"),
model=Gemini(
id="gemini-2.0-flash",
api_key=os.environ.get("GEMINI_API_KEY")
@ -96,23 +93,11 @@ def create_honesty_agent():
markdown=True
)
# # --- Texts Analyzer Agent (Updated with easyocr) ---
# def extract_text_with_easyocr(image):
# """Extract text from image using EasyOCR."""
# reader = easyocr.Reader(['en']) # Specify language
# results = reader.readtext(image)
# # Extract and combine text
# extracted_text = " ".join([result[1] for result in results])
# return extracted_text
# --- Team Leader (Breakup Recovery Team) ---
def create_breakup_team():
return Team(
name="Breakup Recovery Team",
mode="coordinate", # Team execution mode: coordinate or parallel
# model=Gemini(id="gemini-2.0-flash"),
model=Gemini(
id="gemini-2.0-flash",
api_key=os.environ.get("GEMINI_API_KEY")
@ -120,9 +105,8 @@ def create_breakup_team():
members=[
create_therapist_agent(),
create_closure_agent(),
create_routine_agent(), # Added Routine Planner Agent
create_honesty_agent(), # Added Brutal Honesty Agent
# extract_text_with_easyocr()
create_routine_agent(),
create_honesty_agent(),
],
description="You are a team helping someone recover from a breakup.",
instructions=[

View file

@ -3,7 +3,6 @@ from agno.media import Image
from agno.models.google import Gemini
from agno.tools.duckduckgo import DuckDuckGoTools
from PIL import Image as PILImage
import base64
from io import BytesIO
import os
@ -19,13 +18,6 @@ def load_image(image_data):
return img_bytes
# # Check for Google API key
# if "GOOGLE_API_KEY" not in os.environ:
# raise EnvironmentError(
# "Please set your GOOGLE_API_KEY environment variable. "
# "You can get one from https://makersuite.google.com/app/apikey"
# )
def create_chat_analysis_agent():
"""Creates a specialized agent for analyzing chat patterns"""
return Agent(
@ -67,20 +59,4 @@ def analyze_chat_screenshot(image_data):
return response.content
except Exception as e:
return f"Error analyzing chat screenshot: {str(e)}"
# Example local image path - replace with your image path
image_path = "breakup.jpg"
try:
# Load and process the image
image_data = load_image(image_path)
# Create the response using the agent
agent.print_response(
"Tell me about this image and give me the latest news about it.",
images=[Image(content=image_data)],
stream=True,
)
except Exception as e:
print(f"Error processing image: {e}")
return f"Error analyzing chat screenshot: {str(e)}"