Spaces:
Sleeping
Sleeping
Update app.py
Browse filesMinor refactoring
app.py
CHANGED
@@ -9,6 +9,15 @@ from tools.visit_webpage import VisitWebpageTool
|
|
9 |
|
10 |
from Gradio_UI import GradioUI
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
13 |
@tool
|
14 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
@@ -35,20 +44,6 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
35 |
except Exception as e:
|
36 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
37 |
|
38 |
-
|
39 |
-
final_answer = FinalAnswerTool()
|
40 |
-
visit_webpage = VisitWebpageTool()
|
41 |
-
|
42 |
-
# 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:
|
43 |
-
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
44 |
-
|
45 |
-
model = HfApiModel(
|
46 |
-
max_tokens=2096,
|
47 |
-
temperature=0.5,
|
48 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
49 |
-
custom_role_conversions=None,
|
50 |
-
)
|
51 |
-
|
52 |
@tool
|
53 |
def summarize_text_tool(text:str)-> str:
|
54 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
@@ -65,6 +60,9 @@ def summarize_text_tool(text:str)-> str:
|
|
65 |
return f"OH noes, something went wrong...:-/ {str(e)}"
|
66 |
|
67 |
|
|
|
|
|
|
|
68 |
# Import tool from Hub
|
69 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
70 |
|
|
|
9 |
|
10 |
from Gradio_UI import GradioUI
|
11 |
|
12 |
+
# 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:
|
13 |
+
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
14 |
+
model = HfApiModel(
|
15 |
+
max_tokens=2096,
|
16 |
+
temperature=0.5,
|
17 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
18 |
+
custom_role_conversions=None,
|
19 |
+
)
|
20 |
+
|
21 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
22 |
@tool
|
23 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
44 |
except Exception as e:
|
45 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
@tool
|
48 |
def summarize_text_tool(text:str)-> str:
|
49 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
|
|
60 |
return f"OH noes, something went wrong...:-/ {str(e)}"
|
61 |
|
62 |
|
63 |
+
final_answer = FinalAnswerTool()
|
64 |
+
visit_webpage = VisitWebpageTool()
|
65 |
+
|
66 |
# Import tool from Hub
|
67 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
68 |
|