Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
|
|
|
| 2 |
import random
|
|
|
|
| 3 |
from tools.final_answer import FinalAnswerTool
|
| 4 |
from Gradio_UI import GradioUI
|
| 5 |
|
|
@@ -11,116 +13,19 @@ def corporate_nonsense(input_text: str, enthusiasm_level: str = "standard") -> s
|
|
| 11 |
input_text: The normal text to convert
|
| 12 |
enthusiasm_level: How extreme to make it ('standard', 'synergistic', or 'full_consultant')
|
| 13 |
"""
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
'good': ['synergistic', 'paradigm-shifting', 'game-changing', 'disruptive'],
|
| 17 |
-
'bad': ['sub-optimal', 'paradigm-deficient', 'value-deteriorating', 'legacy-minded'],
|
| 18 |
-
'idea': ['value proposition', 'strategic framework', 'thought leadership initiative', 'blue-sky ideation'],
|
| 19 |
-
'meeting': ['deep-dive synchronization', 'stakeholder alignment summit', 'value-stream mapping session', 'agile scrum standup'],
|
| 20 |
-
'problem': ['challenge opportunity', 'growth impediment', 'success barrier', 'optimization potential'],
|
| 21 |
-
'work': ['value creation', 'deliverable orchestration', 'bandwidth allocation', 'resource optimization'],
|
| 22 |
-
'think': ['ideate', 'mindshare', 'thought-shower', 'brain-tsunami'],
|
| 23 |
-
'talk': ['dialogue interface', 'verbal value stream', 'synchronous communication', 'stakeholder soundboarding'],
|
| 24 |
-
'help': ['leverage synergies', 'provide optimization support', 'facilitate enablement', 'drive value realization'],
|
| 25 |
-
'team': ['cross-functional tiger team', 'agile pod', 'centers of excellence', 'value stream collective']
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
corporate_prefixes = [
|
| 29 |
-
"Moving forward,",
|
| 30 |
-
"At the end of the day,",
|
| 31 |
-
"In this space,",
|
| 32 |
-
"Taking this offline,",
|
| 33 |
-
"Per our last alignment,",
|
| 34 |
-
"Through a holistic lens,",
|
| 35 |
-
"With all hands on deck,",
|
| 36 |
-
"In the spirit of transparency,",
|
| 37 |
-
"Leveraging our core competencies,",
|
| 38 |
-
"During this digital transformation journey,"
|
| 39 |
-
]
|
| 40 |
-
|
| 41 |
-
corporate_suffixes = [
|
| 42 |
-
"in accordance with best practices.",
|
| 43 |
-
"to drive meaningful outcomes.",
|
| 44 |
-
"while maintaining operational excellence.",
|
| 45 |
-
"through strategic partnerships.",
|
| 46 |
-
"leveraging our competitive advantage.",
|
| 47 |
-
"in this volatile marketplace.",
|
| 48 |
-
"across the value chain.",
|
| 49 |
-
"with a laser focus on ROI.",
|
| 50 |
-
"utilizing bleeding-edge methodologies.",
|
| 51 |
-
"while pivoting to Web3."
|
| 52 |
-
]
|
| 53 |
-
|
| 54 |
-
amplifiers = {
|
| 55 |
-
'standard': [
|
| 56 |
-
'leverage',
|
| 57 |
-
'optimize',
|
| 58 |
-
'streamline',
|
| 59 |
-
'facilitate'
|
| 60 |
-
],
|
| 61 |
-
'synergistic': [
|
| 62 |
-
'hyper-leverage',
|
| 63 |
-
'mega-optimize',
|
| 64 |
-
'ultra-streamline',
|
| 65 |
-
'super-facilitate'
|
| 66 |
-
],
|
| 67 |
-
'full_consultant': [
|
| 68 |
-
'quantum-leverage',
|
| 69 |
-
'cyber-optimize',
|
| 70 |
-
'blockchain-streamline',
|
| 71 |
-
'ai-powered-facilitate'
|
| 72 |
-
]
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
# Convert text to lowercase for matching
|
| 76 |
-
words = input_text.lower().split()
|
| 77 |
-
translated_words = []
|
| 78 |
-
|
| 79 |
-
# Get appropriate amplifiers based on enthusiasm level
|
| 80 |
-
current_amplifiers = amplifiers.get(enthusiasm_level, amplifiers['standard'])
|
| 81 |
-
|
| 82 |
-
for word in words:
|
| 83 |
-
# Check if word is in our replacement dictionary
|
| 84 |
-
for key, replacements in buzzword_replacements.items():
|
| 85 |
-
if word == key:
|
| 86 |
-
# Add random amplifier based on enthusiasm level
|
| 87 |
-
if random.random() > 0.5:
|
| 88 |
-
translated_words.append(random.choice(current_amplifiers))
|
| 89 |
-
translated_words.append(random.choice(replacements))
|
| 90 |
-
break
|
| 91 |
-
else:
|
| 92 |
-
translated_words.append(word)
|
| 93 |
-
|
| 94 |
-
# Add corporate prefix and suffix
|
| 95 |
-
result = f"{random.choice(corporate_prefixes)} {' '.join(translated_words)} {random.choice(corporate_suffixes)}"
|
| 96 |
-
|
| 97 |
-
# For full_consultant mode, add extra buzzwords
|
| 98 |
-
if enthusiasm_level == 'full_consultant':
|
| 99 |
-
ai_buzzwords = [
|
| 100 |
-
"AI-driven",
|
| 101 |
-
"blockchain-enabled",
|
| 102 |
-
"quantum-computing-powered",
|
| 103 |
-
"machine-learning-optimized",
|
| 104 |
-
"digital-twin-synchronized"
|
| 105 |
-
]
|
| 106 |
-
result = f"{random.choice(ai_buzzwords)} {result}"
|
| 107 |
-
|
| 108 |
-
# Add random KPIs for synergistic and full_consultant modes
|
| 109 |
-
if enthusiasm_level in ['synergistic', 'full_consultant']:
|
| 110 |
-
kpis = [
|
| 111 |
-
"Target KPI: 110% mindshare optimization",
|
| 112 |
-
"Expected ROI: 3000% paradigm shift",
|
| 113 |
-
"Synergy metric: Over 9000",
|
| 114 |
-
"Innovation index: Breaking new ground",
|
| 115 |
-
"Disruption quotient: Maximum"
|
| 116 |
-
]
|
| 117 |
-
result += f"\n{random.choice(kpis)}"
|
| 118 |
-
|
| 119 |
-
return result
|
| 120 |
|
| 121 |
@tool
|
| 122 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 123 |
-
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
try:
|
| 125 |
tz = pytz.timezone(timezone)
|
| 126 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
| 1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
| 2 |
+
import datetime
|
| 3 |
import random
|
| 4 |
+
import pytz
|
| 5 |
from tools.final_answer import FinalAnswerTool
|
| 6 |
from Gradio_UI import GradioUI
|
| 7 |
|
|
|
|
| 13 |
input_text: The normal text to convert
|
| 14 |
enthusiasm_level: How extreme to make it ('standard', 'synergistic', or 'full_consultant')
|
| 15 |
"""
|
| 16 |
+
# [Previous corporate_nonsense implementation remains the same]
|
| 17 |
+
# ... [keeping the same implementation for brevity]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
@tool
|
| 20 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 21 |
+
"""A tool that fetches the current local time in a specified timezone.
|
| 22 |
+
|
| 23 |
+
Args:
|
| 24 |
+
timezone: A string representing a valid timezone (e.g., 'America/New_York', 'Europe/London', 'Asia/Tokyo')
|
| 25 |
+
|
| 26 |
+
Returns:
|
| 27 |
+
str: A formatted string containing the current time in the specified timezone
|
| 28 |
+
"""
|
| 29 |
try:
|
| 30 |
tz = pytz.timezone(timezone)
|
| 31 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|