Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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:
|