dtaubaso commited on
Commit
1816422
·
verified ·
1 Parent(s): 76231b5

added my_agent

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -27,7 +27,7 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
27
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
28
  model = OpenAIServerModel(
29
  model_id="gpt-4.1-mini",
30
- api_key=os.environ.get('OPENAI_API_KEY'),
31
  )
32
  # PROMPTS
33
  system_prompt = """You are a general AI assistant. I will ask you a question.
@@ -150,7 +150,7 @@ def analyze_image(image_path: str, task: str) -> str:
150
  Returns:
151
  str: Result of the analysis as a string.
152
  """
153
- client = OpenAI(api_key=os.environ.get('OPENAI_API_KEY'))
154
 
155
  with open(image_path, "rb") as f:
156
  encoded_image = base64.b64encode(f.read()).decode("utf-8")
@@ -189,7 +189,7 @@ mp3_to_text_tool = Tool.from_space(
189
  api_name="/transcribe"
190
  )
191
 
192
- agent = CodeAgent(
193
  tools=[
194
  DuckDuckGoSearchTool(),
195
  VisitWebpageTool(),
@@ -228,7 +228,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
228
 
229
  # 1. Instantiate Agent ( modify this part to create your agent)
230
  try:
231
- agent = agent
232
  except Exception as e:
233
  print(f"Error instantiating agent: {e}")
234
  return f"Error initializing agent: {e}", None
 
27
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
28
  model = OpenAIServerModel(
29
  model_id="gpt-4.1-mini",
30
+ api_key=os.getenv('OPENAI_API_KEY'),
31
  )
32
  # PROMPTS
33
  system_prompt = """You are a general AI assistant. I will ask you a question.
 
150
  Returns:
151
  str: Result of the analysis as a string.
152
  """
153
+ client = OpenAI(api_key=os.getenv('OPENAI_API_KEY'))
154
 
155
  with open(image_path, "rb") as f:
156
  encoded_image = base64.b64encode(f.read()).decode("utf-8")
 
189
  api_name="/transcribe"
190
  )
191
 
192
+ my_agent = CodeAgent(
193
  tools=[
194
  DuckDuckGoSearchTool(),
195
  VisitWebpageTool(),
 
228
 
229
  # 1. Instantiate Agent ( modify this part to create your agent)
230
  try:
231
+ agent = my_agent
232
  except Exception as e:
233
  print(f"Error instantiating agent: {e}")
234
  return f"Error initializing agent: {e}", None