Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import requests
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
-
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
@@ -34,6 +34,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
| 39 |
# 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:
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
from PIL import Image
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
|
| 37 |
+
|
| 38 |
+
@tool
|
| 39 |
+
def nasa_apod() --> PIL.JpegImagePlugin.JpegImageFile :
|
| 40 |
+
"""A Tool that return the NASA Astronomy of the day picture"""
|
| 41 |
+
try:
|
| 42 |
+
url = 'https://api.nasa.gov/planetary/apod?api_key=vxEb04nrkJxcnq04XNWJTmZUdg3YifPdD6tVugFp'
|
| 43 |
+
out = requests.get(url)
|
| 44 |
+
out_json = out.json()
|
| 45 |
+
img = Image.open(requests.get(out_json['url'], stream=True).raw)
|
| 46 |
+
return img
|
| 47 |
+
except Exception as e:
|
| 48 |
+
return f"Error fetching image : {str(e)}"
|
| 49 |
+
|
| 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:
|