Update app.py
Browse filesReplaced agent = BasicAgent() with my code
app.py
CHANGED
@@ -67,7 +67,26 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
67 |
|
68 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
69 |
try:
|
70 |
-
agent = BasicAgent()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
except Exception as e:
|
72 |
print(f"Error instantiating agent: {e}")
|
73 |
return f"Error initializing agent: {e}", None
|
|
|
67 |
|
68 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
69 |
try:
|
70 |
+
# agent = BasicAgent()
|
71 |
+
model = HfApiModel(
|
72 |
+
max_tokens=2096,
|
73 |
+
temperature=0.5,
|
74 |
+
# model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
75 |
+
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
|
76 |
+
custom_role_conversions=None,
|
77 |
+
)
|
78 |
+
final_answer = FinalAnswerTool()
|
79 |
+
agent = CodeAgent(
|
80 |
+
model=self.model,
|
81 |
+
tools=[self.final_answer], ## add your tools here (don't remove final answer)
|
82 |
+
max_steps=6,
|
83 |
+
verbosity_level=1,
|
84 |
+
grammar=None,
|
85 |
+
planning_interval=None,
|
86 |
+
name=None,
|
87 |
+
description=None,
|
88 |
+
# prompt_templates=prompt_templates
|
89 |
+
)
|
90 |
except Exception as e:
|
91 |
print(f"Error instantiating agent: {e}")
|
92 |
return f"Error initializing agent: {e}", None
|