Spaces:
Sleeping
Sleeping
feat: setup for docker development
Browse files- Dockerfile +13 -0
- Justfile +6 -0
- README.md +1 -1
- requirements.txt +6 -5
- Gradio_UI.py → src/Gradio_UI.py +1 -1
- src/__init__.py +0 -0
- app.py → src/app.py +10 -10
- {tools → src/tools}/final_answer.py +0 -0
- {tools → src/tools}/visit_webpage.py +0 -0
- {tools → src/tools}/web_search.py +0 -0
Dockerfile
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10
|
2 |
+
|
3 |
+
WORKDIR /app
|
4 |
+
|
5 |
+
ADD ./requirements.txt /app
|
6 |
+
|
7 |
+
RUN pip install -r requirements.txt
|
8 |
+
|
9 |
+
COPY ./src /app/src
|
10 |
+
|
11 |
+
COPY ./prompts.yaml /app
|
12 |
+
|
13 |
+
CMD ["python", "src/app.py"]
|
Justfile
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
default:
|
2 |
+
just --list
|
3 |
+
|
4 |
+
run:
|
5 |
+
docker build --tag 'ai-agents-course' .
|
6 |
+
docker run 'ai-agents-course'
|
README.md
CHANGED
@@ -5,7 +5,7 @@ colorFrom: pink
|
|
5 |
colorTo: green
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.15.0
|
8 |
-
app_file: app.py
|
9 |
pinned: false
|
10 |
tags:
|
11 |
- smolagents
|
|
|
5 |
colorTo: green
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.15.0
|
8 |
+
app_file: ./src/app.py
|
9 |
pinned: false
|
10 |
tags:
|
11 |
- smolagents
|
requirements.txt
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
1 |
+
duckduckgo_search == 7.4.4
|
2 |
+
gradio == 5.17.1
|
3 |
+
markdownify == 0.14.1
|
4 |
+
smolagents == 1.9.2
|
5 |
+
requests == 2.32.3
|
6 |
+
pandas == 2.2.3
|
Gradio_UI.py → src/Gradio_UI.py
RENAMED
@@ -293,4 +293,4 @@ class GradioUI:
|
|
293 |
demo.launch(debug=True, share=True, **kwargs)
|
294 |
|
295 |
|
296 |
-
__all__ = ["stream_to_gradio", "GradioUI"]
|
|
|
293 |
demo.launch(debug=True, share=True, **kwargs)
|
294 |
|
295 |
|
296 |
+
__all__ = ["stream_to_gradio", "GradioUI"]
|
src/__init__.py
ADDED
File without changes
|
app.py → src/app.py
RENAMED
@@ -1,17 +1,17 @@
|
|
1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
2 |
import datetime
|
3 |
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 !
|
11 |
@tool
|
12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
-
"""A tool that does nothing yet
|
15 |
Args:
|
16 |
arg1: the first argument
|
17 |
arg2: the second argument
|
@@ -37,13 +37,13 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
37 |
final_answer = FinalAnswerTool()
|
38 |
|
39 |
# 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:
|
40 |
-
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
41 |
|
42 |
model = HfApiModel(
|
43 |
-
max_tokens=2096,
|
44 |
-
temperature=0.5,
|
45 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
46 |
-
custom_role_conversions=None,
|
47 |
)
|
48 |
|
49 |
|
@@ -52,7 +52,7 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
|
|
52 |
|
53 |
with open("prompts.yaml", 'r') as stream:
|
54 |
prompt_templates = yaml.safe_load(stream)
|
55 |
-
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
tools=[final_answer], ## add your tools here (don't remove final answer)
|
@@ -66,4 +66,4 @@ agent = CodeAgent(
|
|
66 |
)
|
67 |
|
68 |
|
69 |
-
GradioUI(agent).launch()
|
|
|
|
|
1 |
import datetime
|
2 |
import requests
|
3 |
import pytz
|
4 |
import yaml
|
|
|
5 |
|
6 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
7 |
+
from tools.final_answer import FinalAnswerTool
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
+
"""A tool that does nothing yet
|
15 |
Args:
|
16 |
arg1: the first argument
|
17 |
arg2: the second argument
|
|
|
37 |
final_answer = FinalAnswerTool()
|
38 |
|
39 |
# 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:
|
40 |
+
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
41 |
|
42 |
model = HfApiModel(
|
43 |
+
max_tokens=2096,
|
44 |
+
temperature=0.5,
|
45 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
46 |
+
custom_role_conversions=None,
|
47 |
)
|
48 |
|
49 |
|
|
|
52 |
|
53 |
with open("prompts.yaml", 'r') as stream:
|
54 |
prompt_templates = yaml.safe_load(stream)
|
55 |
+
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
tools=[final_answer], ## add your tools here (don't remove final answer)
|
|
|
66 |
)
|
67 |
|
68 |
|
69 |
+
GradioUI(agent).launch()
|
{tools → src/tools}/final_answer.py
RENAMED
File without changes
|
{tools → src/tools}/visit_webpage.py
RENAMED
File without changes
|
{tools → src/tools}/web_search.py
RENAMED
File without changes
|