Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,26 +11,6 @@ from Gradio_UI import GradioUI
|
|
11 |
|
12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
13 |
|
14 |
-
@tool
|
15 |
-
def ask_polite_guard(input_text:str)-> str:
|
16 |
-
""" Tool that classifies text into four categories: polite, somewhat polite, neutral and impolite
|
17 |
-
|
18 |
-
Args:
|
19 |
-
arg1: the first argument
|
20 |
-
arg2: the second argument
|
21 |
-
"""
|
22 |
-
try:
|
23 |
-
classifier = pipeline("text-classification", "Intel/polite-guard")
|
24 |
-
return classifier(input_text)
|
25 |
-
except Exception as e:
|
26 |
-
return f"Error fetching classification for text '{input_text}': {str(e)}"
|
27 |
-
# result = polite_guard.check_politeness(user_input)
|
28 |
-
#if result.is_polite:
|
29 |
-
# return "Thank you for your polite message! How can I assist you?"
|
30 |
-
#else:
|
31 |
-
# return "Please rephrase your message to be more polite."
|
32 |
-
|
33 |
-
|
34 |
@tool
|
35 |
def get_current_time_in_timezone(timezone: str) -> str:
|
36 |
"""A tool that fetches the current local time in a specified timezone.
|
@@ -74,7 +54,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
74 |
|
75 |
agent = CodeAgent(
|
76 |
model=model,
|
77 |
-
tools=[final_answer,
|
78 |
max_steps=6,
|
79 |
verbosity_level=1,
|
80 |
grammar=None,
|
|
|
11 |
|
12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
@tool
|
15 |
def get_current_time_in_timezone(timezone: str) -> str:
|
16 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
54 |
|
55 |
agent = CodeAgent(
|
56 |
model=model,
|
57 |
+
tools=[final_answer, get_current_time_in_timezone ], ## add your tools here (don't remove final answer)
|
58 |
max_steps=6,
|
59 |
verbosity_level=1,
|
60 |
grammar=None,
|