jaidesign commited on
Commit
2a6737c
·
verified ·
1 Parent(s): 741bb6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -42,7 +42,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
42
  try:
43
  # Validate timezone
44
  if timezone not in pytz.all_timezones:
45
- return f" Error: '{timezone}' is not a valid timezone. Please provide a correct timezone (e.g., 'America/New_York')."
46
 
47
  # Get the current time in the specified timezone
48
  tz = pytz.timezone(timezone)
@@ -51,10 +51,10 @@ def get_current_time_in_timezone(timezone: str) -> str:
51
  # Format the output with day, date, and time
52
  formatted_time = local_time.strftime("%A, %Y-%m-%d %H:%M:%S %Z")
53
 
54
- return f"🕒 The current local time in **{timezone}** is: **{formatted_time}**"
55
 
56
  except Exception as e:
57
- return f"⚠️ Error fetching time for timezone '{timezone}': {str(e)}"
58
 
59
  @tool
60
  def get_weather(location: str = None, zipcode: int = None) -> str:
@@ -71,7 +71,7 @@ def get_weather(location: str = None, zipcode: int = None) -> str:
71
  conditions = data["weather"][0]["description"]
72
  humidity = data["main"]["humidity"]
73
 
74
- return (f"The current Weather in {location,zipcode} is: {conditions.capitalize()}, Temperature: {temperature}°C, Humidity: {humidity}%")
75
 
76
 
77
  @tool
@@ -106,7 +106,7 @@ model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
106
  model = HfApiModel(
107
  max_tokens=2096,
108
  temperature=0.5,
109
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
110
  #model_id='meta-llama/Llama-3.2-3B-Instruct', # Here I used another model to compare the results
111
  custom_role_conversions=None,
112
  )
 
42
  try:
43
  # Validate timezone
44
  if timezone not in pytz.all_timezones:
45
+ return f" Error: '{timezone}' is not a valid timezone. Please provide a correct timezone (e.g., 'America/New_York')."
46
 
47
  # Get the current time in the specified timezone
48
  tz = pytz.timezone(timezone)
 
51
  # Format the output with day, date, and time
52
  formatted_time = local_time.strftime("%A, %Y-%m-%d %H:%M:%S %Z")
53
 
54
+ return f"The current local time in **{timezone}** is: **{formatted_time}**"
55
 
56
  except Exception as e:
57
+ return f"Error fetching time for timezone '{timezone}': {str(e)}"
58
 
59
  @tool
60
  def get_weather(location: str = None, zipcode: int = None) -> str:
 
71
  conditions = data["weather"][0]["description"]
72
  humidity = data["main"]["humidity"]
73
 
74
+ return (f"The current Weather in {location} is: {conditions.capitalize()}, Temperature: {temperature}°C, Humidity: {humidity}%")
75
 
76
 
77
  @tool
 
106
  model = HfApiModel(
107
  max_tokens=2096,
108
  temperature=0.5,
109
+ #model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
110
  #model_id='meta-llama/Llama-3.2-3B-Instruct', # Here I used another model to compare the results
111
  custom_role_conversions=None,
112
  )