kingkw1 commited on
Commit
d915c2c
·
1 Parent(s): 892984a

feat: add conditional logic to switch between local ChatOllama and remote HuggingFaceEndpoint models

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -32,15 +32,17 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
32
 
33
  # --- Basic Agent Definition ---
34
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
35
- # llm = HuggingFaceEndpoint(
36
- # repo_id = "Qwen/Qwen2.5-Coder-32B-Instruct",
37
- # huggingfacehub_api_token=os.environ.get("HUGGINGFACEHUB_API_TOKEN")
38
- # )
39
-
40
- llm = ChatOllama(
41
- model="gemma4:31b",
42
- temperature=0,
43
- )
 
 
44
 
45
  system_prompt = """You are an AI assistant taking the GAIA benchmark. You must output ONLY the final answer. Do not include any explanations, conversational text or formatting. If the answer is a number, output just the number. If it is a list, output a comma-separated list."""
46
 
 
32
 
33
  # --- Basic Agent Definition ---
34
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
35
+ if IS_LOCAL:
36
+ llm = ChatOllama(
37
+ model="gemma4:31b",
38
+ temperature=0,
39
+ )
40
+ else:
41
+ # When on Hugging Face, use a remote endpoint
42
+ llm = HuggingFaceEndpoint(
43
+ repo_id = "Qwen/Qwen2.5-Coder-32B-Instruct",
44
+ huggingfacehub_api_token=os.environ.get("HUGGINGFACEHUB_API_TOKEN")
45
+ )
46
 
47
  system_prompt = """You are an AI assistant taking the GAIA benchmark. You must output ONLY the final answer. Do not include any explanations, conversational text or formatting. If the answer is a number, output just the number. If it is a list, output a comma-separated list."""
48