samsonDzealot commited on
Commit
d72bda2
·
verified ·
1 Parent(s): a747f8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -3,8 +3,10 @@ import gradio as gr
3
  import requests
4
  import inspect
5
  import pandas as pd
 
 
 
6
 
7
- # (Keep Constants as is)
8
  # --- Constants ---
9
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
10
 
@@ -13,11 +15,20 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
13
  class BasicAgent:
14
  def __init__(self):
15
  print("BasicAgent initialized.")
16
- def __call__(self, question: str) -> str:
17
- print(f"Agent received question (first 50 chars): {question[:50]}...")
18
- fixed_answer = "This is a default answer."
19
- print(f"Agent returning fixed answer: {fixed_answer}")
20
- return fixed_answer
 
 
 
 
 
 
 
 
 
21
 
22
  def run_and_submit_all( profile: gr.OAuthProfile | None):
23
  """
 
3
  import requests
4
  import inspect
5
  import pandas as pd
6
+ import json
7
+ from duckduckgo_search import DDGS
8
+ from dotenv import load_dotenv
9
 
 
10
  # --- Constants ---
11
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
12
 
 
15
  class BasicAgent:
16
  def __init__(self):
17
  print("BasicAgent initialized.")
18
+ # Load environment variables
19
+ load_dotenv()
20
+ self.api_key = os.getenv("TEST_AGENT_KEY")
21
+ self.api_url = DEFAULT_API_URL
22
+ # Load system prompt
23
+ with open("prompt.txt", "r") as file:
24
+ self.system_prompt = file.read().strip()
25
+ # Define tools
26
+ self.tools = {
27
+ "web_search_tool": lambda search_terms: web_search_tool(search_terms),
28
+ "decimal_approximation_tool": lambda number, decimals: decimal_approximation_tool(number, decimals),
29
+ "get_files_task_id_tool": lambda task_id: get_files_task_id_tool(task_id),
30
+ "image_processing_tool": lambda file_content: image_processing_tool(file_content)
31
+ }
32
 
33
  def run_and_submit_all( profile: gr.OAuthProfile | None):
34
  """