cyberosa commited on
Commit
0373f2f
·
1 Parent(s): 21deddb

trying HuggingFace inference provider

Browse files
Files changed (2) hide show
  1. app.py +6 -11
  2. requirements.txt +1 -0
app.py CHANGED
@@ -1,6 +1,6 @@
1
- from smolagents import CodeAgent, load_tool, tool, InferenceClientModel
2
  import datetime
3
- import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
@@ -31,17 +31,12 @@ calories_checker = CaloriesCheckerTool()
31
  # 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:
32
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
33
 
34
- model = InferenceClientModel(
35
- max_tokens=2048,
36
- temperature=0.5,
37
- # alternative model to test "Qwen/Qwen3-32B", "Qwen/Qwen2.5-Coder-7B-Instruct"
38
- model_id="Qwen/Qwen2.5-Coder-7B-Instruct",
39
- # model_id="Qwen/Qwen2.5-Coder-32B-Instruct", # it is possible that this model may be overloaded
40
- custom_role_conversions=None,
41
- # inference_client_url="https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud",
42
  )
43
 
44
-
45
  # Import tool from Hub
46
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
47
 
 
1
+ from smolagents import CodeAgent, load_tool, tool, LiteLLMModel
2
  import datetime
3
+ import os
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
31
  # 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:
32
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
33
 
34
+ gemini_api_key = os.environ.get("GEMINI_API_KEY", None)
35
+ model = LiteLLMModel(
36
+ model_id="gemini/gemini-2.0-flash-lite",
37
+ api_key=gemini_api_key,
 
 
 
 
38
  )
39
 
 
40
  # Import tool from Hub
41
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
42
 
requirements.txt CHANGED
@@ -5,3 +5,4 @@ duckduckgo_search==8.0.1
5
  pandas==2.2.3
6
  gradio==5.29.1
7
  gradio_client==1.10.1
 
 
5
  pandas==2.2.3
6
  gradio==5.29.1
7
  gradio_client==1.10.1
8
+ litellm==1.67.0.post1