Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,8 @@ import datetime
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
|
@@ -48,6 +50,20 @@ def get_weather(city: str) -> str:
|
|
| 48 |
except Exception as e:
|
| 49 |
return f"Error fetching weather conditions for {city}"
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
final_answer = FinalAnswerTool()
|
| 52 |
|
| 53 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
+
import comics
|
| 7 |
+
import random
|
| 8 |
from tools.final_answer import FinalAnswerTool
|
| 9 |
|
| 10 |
from Gradio_UI import GradioUI
|
|
|
|
| 50 |
except Exception as e:
|
| 51 |
return f"Error fetching weather conditions for {city}"
|
| 52 |
|
| 53 |
+
@tool
|
| 54 |
+
def get_comics() -> png:
|
| 55 |
+
"""A tool that fetches random cartoon strip.
|
| 56 |
+
Args:
|
| 57 |
+
"""
|
| 58 |
+
try:
|
| 59 |
+
comicslist = []
|
| 60 |
+
comicslist = comics.directory.listall()
|
| 61 |
+
randomComicName = random.choice(comicslist)
|
| 62 |
+
random_ch = comics.search(randomComicName).random_date()
|
| 63 |
+
return random_ch.show()
|
| 64 |
+
except Exception as e:
|
| 65 |
+
return f"Error fetching cartoon strip. Try again later.”
|
| 66 |
+
|
| 67 |
final_answer = FinalAnswerTool()
|
| 68 |
|
| 69 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|