xenchai commited on
Commit
c502555
·
verified ·
1 Parent(s): 8b50d03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -7,7 +7,9 @@ from Gradio_UI import GradioUI
7
 
8
  @tool
9
  def get_current_time_in_timezone(timezone: str) -> str:
10
- """A tool that fetches the current local time in a specified timezone."""
 
 
11
  try:
12
  tz = pytz.timezone(timezone)
13
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
@@ -15,12 +17,10 @@ def get_current_time_in_timezone(timezone: str) -> str:
15
  except Exception as e:
16
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
17
 
18
- # Initialize tools
19
  duckduckgo_search_tool = DuckDuckGoSearchTool()
20
  final_answer = FinalAnswerTool()
21
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
22
 
23
- # Load system prompt templates
24
  try:
25
  with open("prompts.yaml", 'r') as stream:
26
  prompt_templates = yaml.safe_load(stream)
@@ -29,7 +29,6 @@ except FileNotFoundError:
29
  except yaml.YAMLError as e:
30
  raise ValueError(f"Error parsing YAML file: {str(e)}")
31
 
32
- # Configure the language model
33
  model = HfApiModel(
34
  max_tokens=2096,
35
  temperature=0.5,
 
7
 
8
  @tool
9
  def get_current_time_in_timezone(timezone: str) -> str:
10
+ """A tool that fetches the current local time in a specified timezone.
11
+ Args:
12
+ timezone:takes the specified timezone"""
13
  try:
14
  tz = pytz.timezone(timezone)
15
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
 
17
  except Exception as e:
18
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
19
 
 
20
  duckduckgo_search_tool = DuckDuckGoSearchTool()
21
  final_answer = FinalAnswerTool()
22
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
23
 
 
24
  try:
25
  with open("prompts.yaml", 'r') as stream:
26
  prompt_templates = yaml.safe_load(stream)
 
29
  except yaml.YAMLError as e:
30
  raise ValueError(f"Error parsing YAML file: {str(e)}")
31
 
 
32
  model = HfApiModel(
33
  max_tokens=2096,
34
  temperature=0.5,