Spaces:
Sleeping
Sleeping
Update app.py
Browse files1234527 unmodified lines33343536373812 unmodified lines51525354555657from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,toolimport datetimeimport requestsimport pytzimport yaml27 unmodified linesexcept Exception as e:return f"Error fetching time for timezone '{timezone}': {str(e)}"final_answer = FinalAnswerTool()model = HfApiModel(12 unmodified linesagent = CodeAgent(model=model,tools=[final_answer,my_custom_tool,get_current_time_in_timezone], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,12345627 unmodified lines34353637383940414243444546474849505152535455565758596012 unmodified lines73747576777879from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,toolimport datetimeimport randomimport requestsimport pytzimport yaml27 unmodified linesexcept Exception as e:return f"Error fetching time for timezone '{timezone}': {str(e)}"@tooldef art_critic_tool(image_description: str) -> str:"""A tool that provides an exaggerated and humorous critique of a generated image.Args:image_description: A brief description of the generated image.Returns:A ridiculously dramatic art review of the image."""critiques = [f"Ah, {image_description}! A true masterpiece reminiscent of a lost Da Vinci sketch—if Da Vinci had a love for absurdism!",f"This piece, inspired by {image_description}, clearly speaks to the existential crisis of modern society. Or maybe it just looks funny.",f"Bold! Daring! One could say it's the Picasso of our time... if Picasso had a caffeine overdose while painting.",f"A sublime fusion of chaos and genius. {image_description} truly captures the essence of 'I have no idea what’s going on, but I love it.'",f"This work challenges the viewer to reconsider reality itself! Or perhaps, it just makes you go, ‘Huh?’—either way, iconic."]return random.choice(critiques)final_answer = FinalAnswerTool()model = HfApiModel(12 unmodified linesagent = CodeAgent(model=model,tools=[final_answer,image_generation_tool,art_critic_tool], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,
app.py+23-1