Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from smolagents import
|
| 3 |
|
| 4 |
-
# Step 1:
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def respond(message, history: list[tuple[str, str]], system_message, max_tokens, temperature, top_p):
|
| 9 |
"""
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from smolagents import CodeAgent,HfApiModel # adjust the import to your actual smolagents module
|
| 3 |
|
| 4 |
+
# Step 1: Set up your smolagents agent
|
| 5 |
+
def create_agent():
|
| 6 |
+
"""
|
| 7 |
+
Initialize and return the agent.
|
| 8 |
+
Adjust parameters like model type or configuration as needed.
|
| 9 |
+
"""
|
| 10 |
+
# For example, we initialize an Agent with a sample model
|
| 11 |
+
agent = CodeAgent(tools=[], model=HfApiModel(model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud/')) # Change arguments as per your agent configuration
|
| 12 |
+
return agent
|
| 13 |
+
|
| 14 |
+
# Create the agent instance once so that it persists across user interactions
|
| 15 |
+
agent = create_agent()
|
| 16 |
|
| 17 |
def respond(message, history: list[tuple[str, str]], system_message, max_tokens, temperature, top_p):
|
| 18 |
"""
|