Yudum commited on
Commit
930ef9a
·
verified ·
1 Parent(s): a68e2e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -31,7 +31,11 @@ def generate_image_from_wikipedia(topic: str) -> str:
31
  image = image_generation_tool(summary)
32
 
33
  return image
34
-
 
 
 
 
35
 
36
  @tool
37
  def get_current_time_in_timezone(timezone: str) -> str:
 
31
  image = image_generation_tool(summary)
32
 
33
  return image
34
+
35
+ except wikipedia.exceptions.DisambiguationError as e:
36
+ return f"Multiple topics found: {e.options[:5]}... Please specify further."
37
+ except wikipedia.exceptions.PageError:
38
+ return f"Sorry, no Wikipedia page was found for '{topic}'."
39
 
40
  @tool
41
  def get_current_time_in_timezone(timezone: str) -> str: