Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,17 +3,24 @@ import datetime
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
-
import spaces
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
from Gradio_UI import GradioUI
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 18 |
@tool
|
| 19 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
@@ -28,6 +35,10 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 28 |
|
| 29 |
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
@tool
|
| 32 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 33 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -50,29 +61,15 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
-
final_answer = FinalAnswerTool()
|
| 54 |
-
|
| 55 |
|
| 56 |
-
@spaces.GPU(duration=120)
|
| 57 |
-
def _zero_gpu_check() -> str:
|
| 58 |
-
"""Placeholder GPU function so the ZeroGPU runtime detects a GPU function."""
|
| 59 |
-
return "ok"
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
-
# 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:
|
| 65 |
-
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
-
|
| 70 |
-
model = HfApiModel(
|
| 71 |
-
max_tokens=2096,
|
| 72 |
-
temperature=0.5,
|
| 73 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 74 |
-
custom_role_conversions=None,
|
| 75 |
-
)
|
| 76 |
|
| 77 |
|
| 78 |
|
|
@@ -81,11 +78,8 @@ custom_role_conversions=None,
|
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
-
# Import tool from Hub
|
| 85 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
-
|
| 91 |
-
prompt_templates = yaml.safe_load(stream)
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
from Gradio_UI import GradioUI
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 25 |
@tool
|
| 26 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
@tool
|
| 43 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 44 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
|
|
|
|
|
|
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
|
|
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
+
final_answer = FinalAnswerTool()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
|
| 75 |
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
|
|
|
|
|
|
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
+
# 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:
|
|
|