Spaces:
Sleeping
Sleeping
Update app.py
Browse files31 unmodified lines32333435363717 unmodified lines555657585960614 unmodified lines6667686931 unmodified linesreturn f"The current local time in {timezone} is: {local_time}"except Exception as e:return f"Error fetching time for timezone '{timezone}': {str(e)}"final_answer = FinalAnswerTool()17 unmodified linesagent = CodeAgent(model=model,tools=[final_answer], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,4 unmodified lines)GradioUI(agent).launch()31 unmodified lines3233343536373839404142434445464748495051525354555617 unmodified lines7475767778798081828384854 unmodified lines909192939431 unmodified linesreturn f"The current local time in {timezone} is: {local_time}"except Exception as e:return f"Error fetching time for timezone '{timezone}': {str(e)}"def wikipedia_summary(topic: str) -> str:"""Fetches a summary for a given topic from Wikipedia.Args:topic: The topic to search on Wikipedia."""try:import wikipedia# Set language to Englishwikipedia.set_lang("en")# Get summary of the topicsummary = wikipedia.summary(topic, sentences=3)return f"📚 Wikipedia Summary:\n{summary}"except wikipedia.exceptions.DisambiguationError as e:return f"❗ The topic '{topic}' is ambiguous. Options include: {e.options[:5]}"except wikipedia.exceptions.PageError:return f"❗ No page found for '{topic}'. Please check the spelling."except Exception as e:return f"⚠️ Unexpected error: {str(e)}"final_answer = FinalAnswerTool()17 unmodified linesagent = CodeAgent(model=model,tools=[final_answer,wikipedia_summary, # 👈 Add thisget_current_time_in_timezone, # Optional: if you want to keep itimage_generation_tool # Optional: if you want image gen],max_steps=6,verbosity_level=1,grammar=None,4 unmodified lines)GradioUI(agent).launch()
app.py+26-1