VP21 commited on
Commit
b3a4219
·
verified ·
1 Parent(s): 3af4c1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -12
app.py CHANGED
@@ -19,19 +19,34 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
19
  return "What magic will you build ?"
20
 
21
  @tool
22
- def get_current_time_in_timezone(timezone: str) -> str:
23
- """A tool that fetches the current local time in a specified timezone.
24
- Args:
25
- timezone: A string representing a valid timezone (e.g., 'America/New_York').
26
  """
27
- try:
28
- # Create timezone object
29
- tz = pytz.timezone(timezone)
30
- # Get current time in that timezone
31
- local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
32
- return f"The current local time in {timezone} is: {local_time}"
33
- except Exception as e:
34
- return f"Error fetching time for timezone '{timezone}': {str(e)}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
 
37
  final_answer = FinalAnswerTool()
 
19
  return "What magic will you build ?"
20
 
21
  @tool
22
+ def calculate_bandwidth():
23
+ """
24
+ Calculate the recommended internet speed based on user inputs.
25
+ :return: Recommended bandwidth in Mbps
26
  """
27
+ usage_requirements = {
28
+ "browsing": 1, # Mbps per user
29
+ "video_call": 2, # Mbps per user
30
+ "hd_streaming": 5, # Mbps per user
31
+ "4k_streaming": 25, # Mbps per user
32
+ "gaming": 10, # Mbps per user
33
+ "remote_work": 3 # Mbps per user
34
+ }
35
+
36
+ users = int(input("Enter the number of users: "))
37
+ usage = {
38
+ "browsing": int(input("Users browsing the web: ")),
39
+ "video_call": int(input("Users on video calls: ")),
40
+ "hd_streaming": int(input("Users streaming in HD: ")),
41
+ "4k_streaming": int(input("Users streaming in 4K: ")),
42
+ "gaming": int(input("Users gaming online: ")),
43
+ "remote_work": int(input("Users working remotely: "))
44
+ }
45
+
46
+ total_bandwidth = sum(usage_requirements[activity] * count for activity, count in usage.items())
47
+
48
+ overhead = 1.2 # 20% overhead for seamless experience
49
+ return round(total_bandwidth * overhead, 2)
50
 
51
 
52
  final_answer = FinalAnswerTool()