Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,18 +19,17 @@ def ask_polite_guard(input_text:str)-> str:
|
|
| 19 |
arg1: the first argument
|
| 20 |
arg2: the second argument
|
| 21 |
"""
|
| 22 |
-
try:
|
| 23 |
classifier = pipeline("text-classification", "Intel/polite-guard")
|
|
|
|
|
|
|
|
|
|
| 24 |
# result = polite_guard.check_politeness(user_input)
|
| 25 |
#if result.is_polite:
|
| 26 |
# return "Thank you for your polite message! How can I assist you?"
|
| 27 |
#else:
|
| 28 |
# return "Please rephrase your message to be more polite."
|
| 29 |
-
return classifier(input_text)
|
| 30 |
|
| 31 |
-
except Exception as e:
|
| 32 |
-
return f"Error fetching classification for text '{input_text}': {str(e)}"
|
| 33 |
-
|
| 34 |
|
| 35 |
@tool
|
| 36 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 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:
|