Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,12 +14,12 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 14 |
|
| 15 |
# --- Agent Definition ---
|
| 16 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 17 |
-
class
|
| 18 |
"""Coder agent that is running the Qwen2.5 coder model and can generate and execute python code. It can import the pandas library for """
|
| 19 |
def __init__(self):
|
| 20 |
model = InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct")
|
| 21 |
|
| 22 |
-
|
| 23 |
model=model,
|
| 24 |
tools=[
|
| 25 |
#visit_webpage,
|
|
@@ -42,7 +42,9 @@ class coder_agent:
|
|
| 42 |
)
|
| 43 |
|
| 44 |
def __call__(self, prompt: str) -> str:
|
| 45 |
-
|
|
|
|
|
|
|
| 46 |
|
| 47 |
#class vision_agent:
|
| 48 |
# """This vision agent is able to be passed base64-encoded image data and will use the OpenAI gpt-4o model to decode it and identify objects within. It will return a textual description of the image."""
|
|
@@ -55,7 +57,7 @@ class MasterAgent:
|
|
| 55 |
model=InferenceClientModel("deepseek-ai/DeepSeek-R1", max_tokens=8096),
|
| 56 |
|
| 57 |
try:
|
| 58 |
-
coder_agent =
|
| 59 |
except Exception as e:
|
| 60 |
print(f"Error instantiating agent: {e}")
|
| 61 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 14 |
|
| 15 |
# --- Agent Definition ---
|
| 16 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 17 |
+
class CoderAgent:
|
| 18 |
"""Coder agent that is running the Qwen2.5 coder model and can generate and execute python code. It can import the pandas library for """
|
| 19 |
def __init__(self):
|
| 20 |
model = InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct")
|
| 21 |
|
| 22 |
+
self.coder_agent = CodeAgent(
|
| 23 |
model=model,
|
| 24 |
tools=[
|
| 25 |
#visit_webpage,
|
|
|
|
| 42 |
)
|
| 43 |
|
| 44 |
def __call__(self, prompt: str) -> str:
|
| 45 |
+
agent_answer = self.coder_agent.run(prompt)
|
| 46 |
+
print(f"Managed agent answer: {agent_answer}")
|
| 47 |
+
return agent_answer
|
| 48 |
|
| 49 |
#class vision_agent:
|
| 50 |
# """This vision agent is able to be passed base64-encoded image data and will use the OpenAI gpt-4o model to decode it and identify objects within. It will return a textual description of the image."""
|
|
|
|
| 57 |
model=InferenceClientModel("deepseek-ai/DeepSeek-R1", max_tokens=8096),
|
| 58 |
|
| 59 |
try:
|
| 60 |
+
coder_agent = CoderAgent()
|
| 61 |
except Exception as e:
|
| 62 |
print(f"Error instantiating agent: {e}")
|
| 63 |
return f"Error initializing agent: {e}", None
|