Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
ef87fec
1
Parent(s):
8c9bea9
Added Transformers models
Browse files- agents/all_agents.py +0 -1
- app.py +8 -17
- llm.py +14 -1
- pyproject.toml +3 -2
- requirements.txt +47 -1
agents/all_agents.py
CHANGED
@@ -80,7 +80,6 @@ def get_master_agent(llm):
|
|
80 |
ImageResizeTool(),
|
81 |
# UpscalerTool(),
|
82 |
],
|
83 |
-
use_structured_outputs_internally=True,
|
84 |
verbosity_level=LogLevel.DEBUG,
|
85 |
)
|
86 |
print("Loaded master agent")
|
|
|
80 |
ImageResizeTool(),
|
81 |
# UpscalerTool(),
|
82 |
],
|
|
|
83 |
verbosity_level=LogLevel.DEBUG,
|
84 |
)
|
85 |
print("Loaded master agent")
|
app.py
CHANGED
@@ -7,7 +7,7 @@ from gradio import ChatMessage
|
|
7 |
from smolagents.gradio_ui import stream_to_gradio
|
8 |
|
9 |
from agents.all_agents import get_master_agent
|
10 |
-
from llm import
|
11 |
|
12 |
|
13 |
def resize_image(image):
|
@@ -22,8 +22,8 @@ def resize_image(image):
|
|
22 |
|
23 |
|
24 |
@spaces.GPU
|
25 |
-
def chat_interface_fn(input_request, history: List[ChatMessage], gallery,
|
26 |
-
model =
|
27 |
agent = get_master_agent(model)
|
28 |
if gallery is None:
|
29 |
gallery = []
|
@@ -126,22 +126,13 @@ with gr.Blocks() as demo:
|
|
126 |
gr.Markdown(
|
127 |
"""
|
128 |
## Update 17/06/2025
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
"""
|
133 |
-
)
|
134 |
-
anthropic_api_key = gr.Textbox(label="Anthropic API Key")
|
135 |
-
anthropic_model_id = gr.Dropdown(label="Anthropic Model", choices=ANTHROPIC_MODEL_IDS)
|
136 |
-
gr.Markdown(
|
137 |
-
"""
|
138 |
-
## Future plans
|
139 |
-
I plan to continue developing this Space on a more personal space here : https://huggingface.co/spaces/stevenbucaille/ScouterAI <br>
|
140 |
-
This Space will be powered with ZeroGPU and have more LLM options.<br>
|
141 |
-
Stay tuned!
|
142 |
<br>
|
143 |
"""
|
144 |
)
|
|
|
145 |
output_gallery = gr.Gallery(label="Images generated by the agent (do not put images)", type="pil", format="png")
|
146 |
textbox = gr.MultimodalTextbox()
|
147 |
gr.ChatInterface(
|
@@ -149,7 +140,7 @@ with gr.Blocks() as demo:
|
|
149 |
type="messages",
|
150 |
multimodal=True,
|
151 |
textbox=textbox,
|
152 |
-
additional_inputs=[output_gallery,
|
153 |
additional_outputs=[output_gallery],
|
154 |
)
|
155 |
|
|
|
7 |
from smolagents.gradio_ui import stream_to_gradio
|
8 |
|
9 |
from agents.all_agents import get_master_agent
|
10 |
+
from llm import TRANSFORMERS_MODEL_IDS, get_transformers_model
|
11 |
|
12 |
|
13 |
def resize_image(image):
|
|
|
22 |
|
23 |
|
24 |
@spaces.GPU
|
25 |
+
def chat_interface_fn(input_request, history: List[ChatMessage], gallery, transformers_model_id):
|
26 |
+
model = get_transformers_model(transformers_model_id)
|
27 |
agent = get_master_agent(model)
|
28 |
if gallery is None:
|
29 |
gallery = []
|
|
|
126 |
gr.Markdown(
|
127 |
"""
|
128 |
## Update 17/06/2025
|
129 |
+
Welcome to the new version of ScouterAI!<br>
|
130 |
+
This Space is now powered by ZeroGPU, which means you can use it for free!<br>
|
131 |
+
You can now use any model from the HuggingFace Hub, just provide the model ID below.<br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
<br>
|
133 |
"""
|
134 |
)
|
135 |
+
transformers_model_id = gr.Dropdown(label="Transformers Model ID", info="Select a model to use or provide your own model ID", choices=TRANSFORMERS_MODEL_IDS)
|
136 |
output_gallery = gr.Gallery(label="Images generated by the agent (do not put images)", type="pil", format="png")
|
137 |
textbox = gr.MultimodalTextbox()
|
138 |
gr.ChatInterface(
|
|
|
140 |
type="messages",
|
141 |
multimodal=True,
|
142 |
textbox=textbox,
|
143 |
+
additional_inputs=[output_gallery, transformers_model_id],
|
144 |
additional_outputs=[output_gallery],
|
145 |
)
|
146 |
|
llm.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from smolagents import LiteLLMModel
|
2 |
|
3 |
|
4 |
ANTHROPIC_MODEL_IDS = [
|
@@ -13,6 +13,14 @@ ANTHROPIC_MODEL_IDS = [
|
|
13 |
"claude-3-haiku-20240307",
|
14 |
]
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
def get_anthropic_model(model_id, anthropic_api_key):
|
18 |
if model_id not in ANTHROPIC_MODEL_IDS:
|
@@ -22,3 +30,8 @@ def get_anthropic_model(model_id, anthropic_api_key):
|
|
22 |
api_key=anthropic_api_key,
|
23 |
)
|
24 |
return model
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from smolagents import LiteLLMModel, TransformersModel
|
2 |
|
3 |
|
4 |
ANTHROPIC_MODEL_IDS = [
|
|
|
13 |
"claude-3-haiku-20240307",
|
14 |
]
|
15 |
|
16 |
+
TRANSFORMERS_MODEL_IDS = [
|
17 |
+
"Qwen/Qwen2.5-VL-3B-Instruct",
|
18 |
+
"Qwen/Qwen2.5-VL-7B-Instruct",
|
19 |
+
"Qwen/Qwen2.5-VL-14B-Instruct",
|
20 |
+
"Qwen/Qwen2.5-VL-32B-Instruct",
|
21 |
+
"Qwen/Qwen2.5-VL-72B-Instruct",
|
22 |
+
]
|
23 |
+
|
24 |
|
25 |
def get_anthropic_model(model_id, anthropic_api_key):
|
26 |
if model_id not in ANTHROPIC_MODEL_IDS:
|
|
|
30 |
api_key=anthropic_api_key,
|
31 |
)
|
32 |
return model
|
33 |
+
|
34 |
+
|
35 |
+
def get_transformers_model(model_id):
|
36 |
+
model = TransformersModel(model_id=model_id)
|
37 |
+
return model
|
pyproject.toml
CHANGED
@@ -12,7 +12,7 @@ dependencies = [
|
|
12 |
"faiss-gpu>=1.7.2",
|
13 |
"gradio>=5.33.0",
|
14 |
"hf-transfer>=0.1.9",
|
15 |
-
"huggingface-hub[cli]>=0.32.4",
|
16 |
"langchain>=0.3.25",
|
17 |
"langchain-community>=0.3.24",
|
18 |
"langchain-huggingface>=0.2.0",
|
@@ -25,7 +25,8 @@ dependencies = [
|
|
25 |
"safetensors>=0.5.3",
|
26 |
"scipy>=1.15.3",
|
27 |
"sentence-transformers>=4.1.0",
|
28 |
-
"smolagents[litellm,mcp,openai]>=1.17.0",
|
|
|
29 |
"supervision>=0.25.1",
|
30 |
"timm>=1.0.15",
|
31 |
"torch==2.5.1",
|
|
|
12 |
"faiss-gpu>=1.7.2",
|
13 |
"gradio>=5.33.0",
|
14 |
"hf-transfer>=0.1.9",
|
15 |
+
"huggingface-hub[cli,hf-xet]>=0.32.4",
|
16 |
"langchain>=0.3.25",
|
17 |
"langchain-community>=0.3.24",
|
18 |
"langchain-huggingface>=0.2.0",
|
|
|
25 |
"safetensors>=0.5.3",
|
26 |
"scipy>=1.15.3",
|
27 |
"sentence-transformers>=4.1.0",
|
28 |
+
"smolagents[litellm,mcp,openai,vllm]>=1.17.0",
|
29 |
+
"spaces>=0.37.0",
|
30 |
"supervision>=0.25.1",
|
31 |
"timm>=1.0.15",
|
32 |
"torch==2.5.1",
|
requirements.txt
CHANGED
@@ -5,30 +5,44 @@ aiofiles==24.1.0
|
|
5 |
aiohappyeyeballs==2.6.1
|
6 |
aiohttp==3.12.9
|
7 |
aiosignal==1.3.2
|
|
|
8 |
annotated-types==0.7.0
|
9 |
anyio==4.9.0
|
|
|
10 |
async-timeout==4.0.3
|
11 |
attrs==25.3.0
|
|
|
12 |
certifi==2025.4.26
|
13 |
charset-normalizer==3.4.2
|
14 |
click==8.1.8
|
|
|
|
|
15 |
contourpy==1.3.2
|
|
|
16 |
cycler==0.12.1
|
17 |
dataclasses-json==0.6.7
|
18 |
datasets==3.6.0
|
19 |
defusedxml==0.7.1
|
|
|
20 |
diffusers==0.33.1
|
21 |
dill==0.3.8
|
|
|
22 |
distro==1.9.0
|
|
|
|
|
|
|
23 |
exceptiongroup==1.3.0
|
24 |
faiss-cpu==1.11.0
|
25 |
faiss-gpu==1.7.2
|
26 |
fastapi==0.115.12
|
|
|
|
|
27 |
ffmpy==0.6.0
|
28 |
filelock==3.18.0
|
29 |
fonttools==4.58.1
|
30 |
frozenlist==1.6.2
|
31 |
fsspec==2025.3.0
|
|
|
32 |
gradio==5.33.0
|
33 |
gradio-client==1.10.2
|
34 |
greenlet==3.2.3
|
@@ -40,13 +54,16 @@ hf-transfer==0.1.9
|
|
40 |
hf-xet==1.1.3
|
41 |
hpack==4.1.0
|
42 |
httpcore==1.0.9
|
|
|
43 |
httpx==0.28.1
|
44 |
httpx-sse==0.4.0
|
45 |
huggingface-hub==0.32.4
|
46 |
hyperframe==6.1.0
|
47 |
idna==3.10
|
48 |
importlib-metadata==8.7.0
|
|
|
49 |
inquirerpy==0.3.4
|
|
|
50 |
jinja2==3.1.6
|
51 |
jiter==0.10.0
|
52 |
joblib==1.5.1
|
@@ -63,7 +80,10 @@ langchain-huggingface==0.2.0
|
|
63 |
langchain-openai==0.3.21
|
64 |
langchain-text-splitters==0.3.8
|
65 |
langsmith==0.3.45
|
|
|
66 |
litellm==1.72.1
|
|
|
|
|
67 |
markdown-it-py==3.0.0
|
68 |
markupsafe==3.0.2
|
69 |
marshmallow==3.26.1
|
@@ -71,13 +91,18 @@ matplotlib==3.10.3
|
|
71 |
mcp==1.9.3
|
72 |
mcpadapt==0.1.9
|
73 |
mdurl==0.1.2
|
|
|
74 |
modal==1.0.3
|
75 |
mpmath==1.3.0
|
|
|
|
|
76 |
multidict==6.4.4
|
77 |
multiprocess==0.70.16
|
78 |
mypy-extensions==1.1.0
|
|
|
79 |
networkx==3.4.2
|
80 |
-
|
|
|
81 |
nvidia-cublas-cu12==12.4.5.8
|
82 |
nvidia-cuda-cupti-cu12==12.4.127
|
83 |
nvidia-cuda-nvrtc-cu12==12.4.127
|
@@ -92,33 +117,47 @@ nvidia-nvjitlink-cu12==12.4.127
|
|
92 |
nvidia-nvtx-cu12==12.4.127
|
93 |
openai==1.84.0
|
94 |
opencv-python==4.11.0.86
|
|
|
95 |
orjson==3.10.18
|
|
|
|
|
96 |
packaging==24.2
|
97 |
pandas==2.3.0
|
|
|
98 |
pfzy==0.3.4
|
99 |
pillow==11.2.1
|
|
|
|
|
|
|
100 |
prompt-toolkit==3.0.51
|
101 |
propcache==0.3.1
|
102 |
protobuf==6.31.1
|
103 |
psutil==5.9.8
|
|
|
104 |
pyarrow==20.0.0
|
|
|
|
|
105 |
pydantic==2.11.5
|
106 |
pydantic-core==2.33.2
|
107 |
pydantic-settings==2.9.1
|
108 |
pydub==0.25.1
|
109 |
pygments==2.19.1
|
110 |
pyparsing==3.2.3
|
|
|
111 |
python-dateutil==2.9.0.post0
|
112 |
python-dotenv==1.1.0
|
113 |
python-multipart==0.0.20
|
114 |
pytz==2025.2
|
115 |
pyyaml==6.0.2
|
|
|
116 |
rank-bm25==0.2.2
|
|
|
117 |
referencing==0.36.2
|
118 |
regex==2024.11.6
|
119 |
requests==2.32.3
|
120 |
requests-toolbelt==1.0.0
|
121 |
rich==14.0.0
|
|
|
122 |
rpds-py==0.25.1
|
123 |
ruff==0.11.12
|
124 |
safehttpx==0.1.6
|
@@ -127,6 +166,7 @@ scikit-learn==1.7.0
|
|
127 |
scipy==1.15.3
|
128 |
semantic-version==2.10.0
|
129 |
sentence-transformers==4.1.0
|
|
|
130 |
shellingham==1.5.4
|
131 |
sigtools==4.0.1
|
132 |
six==1.17.0
|
@@ -145,8 +185,10 @@ tiktoken==0.9.0
|
|
145 |
timm==1.0.15
|
146 |
tokenizers==0.21.1
|
147 |
toml==0.10.2
|
|
|
148 |
tomlkit==0.13.3
|
149 |
torch==2.5.1
|
|
|
150 |
torchvision==0.20.1
|
151 |
tqdm==4.67.1
|
152 |
transformers==4.52.4
|
@@ -160,9 +202,13 @@ typing-inspection==0.4.1
|
|
160 |
tzdata==2025.2
|
161 |
urllib3==2.4.0
|
162 |
uvicorn==0.34.3
|
|
|
|
|
163 |
watchfiles==1.0.5
|
164 |
wcwidth==0.2.13
|
165 |
websockets==15.0.1
|
|
|
|
|
166 |
xxhash==3.5.0
|
167 |
yarl==1.20.0
|
168 |
zipp==3.22.0
|
|
|
5 |
aiohappyeyeballs==2.6.1
|
6 |
aiohttp==3.12.9
|
7 |
aiosignal==1.3.2
|
8 |
+
airportsdata==20250523
|
9 |
annotated-types==0.7.0
|
10 |
anyio==4.9.0
|
11 |
+
astor==0.8.1
|
12 |
async-timeout==4.0.3
|
13 |
attrs==25.3.0
|
14 |
+
blake3==1.0.5
|
15 |
certifi==2025.4.26
|
16 |
charset-normalizer==3.4.2
|
17 |
click==8.1.8
|
18 |
+
cloudpickle==3.1.1
|
19 |
+
compressed-tensors==0.9.1
|
20 |
contourpy==1.3.2
|
21 |
+
cupy-cuda12x==13.4.1
|
22 |
cycler==0.12.1
|
23 |
dataclasses-json==0.6.7
|
24 |
datasets==3.6.0
|
25 |
defusedxml==0.7.1
|
26 |
+
depyf==0.18.0
|
27 |
diffusers==0.33.1
|
28 |
dill==0.3.8
|
29 |
+
diskcache==5.6.3
|
30 |
distro==1.9.0
|
31 |
+
dnspython==2.7.0
|
32 |
+
einops==0.8.1
|
33 |
+
email-validator==2.2.0
|
34 |
exceptiongroup==1.3.0
|
35 |
faiss-cpu==1.11.0
|
36 |
faiss-gpu==1.7.2
|
37 |
fastapi==0.115.12
|
38 |
+
fastapi-cli==0.0.7
|
39 |
+
fastrlock==0.8.3
|
40 |
ffmpy==0.6.0
|
41 |
filelock==3.18.0
|
42 |
fonttools==4.58.1
|
43 |
frozenlist==1.6.2
|
44 |
fsspec==2025.3.0
|
45 |
+
gguf==0.10.0
|
46 |
gradio==5.33.0
|
47 |
gradio-client==1.10.2
|
48 |
greenlet==3.2.3
|
|
|
54 |
hf-xet==1.1.3
|
55 |
hpack==4.1.0
|
56 |
httpcore==1.0.9
|
57 |
+
httptools==0.6.4
|
58 |
httpx==0.28.1
|
59 |
httpx-sse==0.4.0
|
60 |
huggingface-hub==0.32.4
|
61 |
hyperframe==6.1.0
|
62 |
idna==3.10
|
63 |
importlib-metadata==8.7.0
|
64 |
+
iniconfig==2.1.0
|
65 |
inquirerpy==0.3.4
|
66 |
+
interegular==0.3.3
|
67 |
jinja2==3.1.6
|
68 |
jiter==0.10.0
|
69 |
joblib==1.5.1
|
|
|
80 |
langchain-openai==0.3.21
|
81 |
langchain-text-splitters==0.3.8
|
82 |
langsmith==0.3.45
|
83 |
+
lark==1.2.2
|
84 |
litellm==1.72.1
|
85 |
+
llvmlite==0.43.0
|
86 |
+
lm-format-enforcer==0.10.11
|
87 |
markdown-it-py==3.0.0
|
88 |
markupsafe==3.0.2
|
89 |
marshmallow==3.26.1
|
|
|
91 |
mcp==1.9.3
|
92 |
mcpadapt==0.1.9
|
93 |
mdurl==0.1.2
|
94 |
+
mistral-common==1.6.2
|
95 |
modal==1.0.3
|
96 |
mpmath==1.3.0
|
97 |
+
msgpack==1.1.1
|
98 |
+
msgspec==0.19.0
|
99 |
multidict==6.4.4
|
100 |
multiprocess==0.70.16
|
101 |
mypy-extensions==1.1.0
|
102 |
+
nest-asyncio==1.6.0
|
103 |
networkx==3.4.2
|
104 |
+
numba==0.60.0
|
105 |
+
numpy==1.26.4
|
106 |
nvidia-cublas-cu12==12.4.5.8
|
107 |
nvidia-cuda-cupti-cu12==12.4.127
|
108 |
nvidia-cuda-nvrtc-cu12==12.4.127
|
|
|
117 |
nvidia-nvtx-cu12==12.4.127
|
118 |
openai==1.84.0
|
119 |
opencv-python==4.11.0.86
|
120 |
+
opencv-python-headless==4.11.0.86
|
121 |
orjson==3.10.18
|
122 |
+
outlines==0.1.11
|
123 |
+
outlines-core==0.1.26
|
124 |
packaging==24.2
|
125 |
pandas==2.3.0
|
126 |
+
partial-json-parser==0.2.1.1.post5
|
127 |
pfzy==0.3.4
|
128 |
pillow==11.2.1
|
129 |
+
pluggy==1.6.0
|
130 |
+
prometheus-client==0.22.1
|
131 |
+
prometheus-fastapi-instrumentator==7.1.0
|
132 |
prompt-toolkit==3.0.51
|
133 |
propcache==0.3.1
|
134 |
protobuf==6.31.1
|
135 |
psutil==5.9.8
|
136 |
+
py-cpuinfo==9.0.0
|
137 |
pyarrow==20.0.0
|
138 |
+
pybind11==2.13.6
|
139 |
+
pycountry==24.6.1
|
140 |
pydantic==2.11.5
|
141 |
pydantic-core==2.33.2
|
142 |
pydantic-settings==2.9.1
|
143 |
pydub==0.25.1
|
144 |
pygments==2.19.1
|
145 |
pyparsing==3.2.3
|
146 |
+
pytest==8.4.0
|
147 |
python-dateutil==2.9.0.post0
|
148 |
python-dotenv==1.1.0
|
149 |
python-multipart==0.0.20
|
150 |
pytz==2025.2
|
151 |
pyyaml==6.0.2
|
152 |
+
pyzmq==27.0.0
|
153 |
rank-bm25==0.2.2
|
154 |
+
ray==2.40.0
|
155 |
referencing==0.36.2
|
156 |
regex==2024.11.6
|
157 |
requests==2.32.3
|
158 |
requests-toolbelt==1.0.0
|
159 |
rich==14.0.0
|
160 |
+
rich-toolkit==0.14.7
|
161 |
rpds-py==0.25.1
|
162 |
ruff==0.11.12
|
163 |
safehttpx==0.1.6
|
|
|
166 |
scipy==1.15.3
|
167 |
semantic-version==2.10.0
|
168 |
sentence-transformers==4.1.0
|
169 |
+
sentencepiece==0.2.0
|
170 |
shellingham==1.5.4
|
171 |
sigtools==4.0.1
|
172 |
six==1.17.0
|
|
|
185 |
timm==1.0.15
|
186 |
tokenizers==0.21.1
|
187 |
toml==0.10.2
|
188 |
+
tomli==2.2.1
|
189 |
tomlkit==0.13.3
|
190 |
torch==2.5.1
|
191 |
+
torchaudio==2.5.1
|
192 |
torchvision==0.20.1
|
193 |
tqdm==4.67.1
|
194 |
transformers==4.52.4
|
|
|
202 |
tzdata==2025.2
|
203 |
urllib3==2.4.0
|
204 |
uvicorn==0.34.3
|
205 |
+
uvloop==0.21.0
|
206 |
+
vllm==0.7.3
|
207 |
watchfiles==1.0.5
|
208 |
wcwidth==0.2.13
|
209 |
websockets==15.0.1
|
210 |
+
xformers==0.0.28.post3
|
211 |
+
xgrammar==0.1.11
|
212 |
xxhash==3.5.0
|
213 |
yarl==1.20.0
|
214 |
zipp==3.22.0
|