Spaces:
Sleeping
Sleeping
feat: add api token and rename variable names
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 !
|
|
@@ -33,19 +33,19 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
final_answer = FinalAnswerTool()
|
| 40 |
|
| 41 |
# 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:
|
| 42 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 43 |
|
| 44 |
model = HfApiModel(
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
| 49 |
)
|
| 50 |
|
| 51 |
|
|
@@ -57,7 +57,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 57 |
|
| 58 |
agent = CodeAgent(
|
| 59 |
model=model,
|
| 60 |
-
tools=[
|
| 61 |
max_steps=6,
|
| 62 |
verbosity_level=1,
|
| 63 |
grammar=None,
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
import os
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
+
current_time_tool = get_current_time_in_timezone
|
| 37 |
+
search_tool = DuckDuckGoSearchTool()
|
|
|
|
| 38 |
final_answer = FinalAnswerTool()
|
| 39 |
|
| 40 |
# 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:
|
| 41 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 42 |
|
| 43 |
model = HfApiModel(
|
| 44 |
+
token=os.environ["HF_API_TOKEN"],
|
| 45 |
+
max_tokens=2096,
|
| 46 |
+
temperature=0.5,
|
| 47 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 48 |
+
custom_role_conversions=None,
|
| 49 |
)
|
| 50 |
|
| 51 |
|
|
|
|
| 57 |
|
| 58 |
agent = CodeAgent(
|
| 59 |
model=model,
|
| 60 |
+
tools=[current_time_tool, search_tool, image_generation_tool, final_answer], ## add your tools here (don't remove final answer)
|
| 61 |
max_steps=6,
|
| 62 |
verbosity_level=1,
|
| 63 |
grammar=None,
|