Spaces:
Build error
Build error
Update app.py
Browse files17 unmodified lines18192021222325 unmodified lines4950515253545556575859606117 unmodified lines"""return "What magic will you build ?"@tooldef get_current_time_in_timezone(timezone: str) -> str:"""A tool that fetches the current local time in a specified timezone.25 unmodified lines# Import tool from Hubimage_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)with open("prompts.yaml", 'r') as stream:prompt_templates = yaml.safe_load(stream)agent = CodeAgent(model=model,tools=[final_answer, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,17 unmodified lines1819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626325 unmodified lines899091929394959697989910010110217 unmodified lines"""return "What magic will you build ?"@tooldef generate_meme_text(topic: str, tone: str) -> str:"""Generates a funny meme caption based on a topic and tone.Args:topic: What the meme is about (e.g. 'Python', 'Mondays').tone: Style of humor (e.g. 'sarcastic', 'dark', 'wholesome')."""topic = topic.strip().capitalize()tone = tone.strip().lower()templates = {"sarcastic": [f"{topic}? Oh sure, because *that* always works.",f"When {topic} is your coping mechanism.",f"I live, laugh, {topic}... and cry."],"dark": [f"{topic}: the reason I trust no one.",f"Behind every {topic} is a story of despair.",f"If {topic} was a person, I’d ghost them."],"wholesome": [f"{topic} is my happy place 💖",f"Start your day with a smile and a little {topic}.",f"When in doubt, {topic} it out!"],"random": [f"{topic}? That escalated quickly.",f"One does not simply survive {topic}.",f"{topic} – it's a lifestyle choice."]}# Choose from tone, fallback to "random"selected = templates.get(tone, templates["random"])import randomreturn random.choice(selected)@tooldef get_current_time_in_timezone(timezone: str) -> str:"""A tool that fetches the current local time in a specified timezone.25 unmodified lines# Import tool from Hubimage_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)search_tool = DuckDuckGoSearchTool()with open("prompts.yaml", 'r') as stream:prompt_templates = yaml.safe_load(stream)agent = CodeAgent(model=model,tools=[final_answer, get_current_time_in_timezone, search_tool, image_generation_tool, generate_meme_text], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,
app.py+42-1