Spaces:
Sleeping
Sleeping
Replace Qwen model with Gemini
Browse files* Create a Google Gemini API key: https://discord.com/channels/879548962464493619/1360558713274109982/1360558713274109982
* Solution to the error "You have exceeded your monthly included credits for Inference Providers": https://discord.com/channels/879548962464493619/1367145601543966791/1367145601543966791
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool,
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
@@ -47,14 +47,11 @@ final_answer = FinalAnswerTool()
|
|
| 47 |
# 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:
|
| 48 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 49 |
|
| 50 |
-
model =
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 54 |
-
custom_role_conversions=None,
|
| 55 |
)
|
| 56 |
|
| 57 |
-
|
| 58 |
# Import tool from Hub
|
| 59 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 60 |
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, LiteLLMModel, load_tool, tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
|
|
| 47 |
# 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:
|
| 48 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 49 |
|
| 50 |
+
model = LiteLLMModel(
|
| 51 |
+
model_id="gemini/gemini-2.0-flash-lite",
|
| 52 |
+
api_key=os.getenv("GEMINI_API_TOKEN")
|
|
|
|
|
|
|
| 53 |
)
|
| 54 |
|
|
|
|
| 55 |
# Import tool from Hub
|
| 56 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 57 |
|