Spaces:
Sleeping
Sleeping
feat: add conditional logic to switch between local ChatOllama and remote HuggingFaceEndpoint models
Browse files
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 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 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 |
|