Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,6 @@ 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 !
|
|
@@ -41,22 +40,22 @@ final_answer = FinalAnswerTool()
|
|
| 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 |
max_tokens=2096,
|
| 46 |
temperature=0.5,
|
| 47 |
-
model_id='
|
| 48 |
custom_role_conversions=None,
|
| 49 |
)
|
| 50 |
|
| 51 |
-
#
|
| 52 |
-
search_tool = DuckDuckGoSearchTool()
|
| 53 |
-
|
| 54 |
with open("prompts.yaml", 'r') as stream:
|
| 55 |
prompt_templates = yaml.safe_load(stream)
|
| 56 |
|
|
|
|
| 57 |
agent = CodeAgent(
|
| 58 |
model=model,
|
| 59 |
-
tools=[final_answer,
|
| 60 |
max_steps=6,
|
| 61 |
verbosity_level=1,
|
| 62 |
grammar=None,
|
|
@@ -66,5 +65,5 @@ agent = CodeAgent(
|
|
| 66 |
prompt_templates=prompt_templates
|
| 67 |
)
|
| 68 |
|
| 69 |
-
|
| 70 |
GradioUI(agent).launch()
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
| 7 |
from Gradio_UI import GradioUI
|
| 8 |
|
| 9 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 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 |
+
# Define the AI model
|
| 44 |
model = HfApiModel(
|
| 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 |
+
# Load prompt templates
|
|
|
|
|
|
|
| 52 |
with open("prompts.yaml", 'r') as stream:
|
| 53 |
prompt_templates = yaml.safe_load(stream)
|
| 54 |
|
| 55 |
+
# Create the AI agent with tools
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
+
tools=[final_answer,my_custom_tool,get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 65 |
prompt_templates=prompt_templates
|
| 66 |
)
|
| 67 |
|
| 68 |
+
# Launch the AI agent with Gradio
|
| 69 |
GradioUI(agent).launch()
|