Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,6 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
13 |
|
14 |
# --- Конфигурация ---
|
15 |
HF_TOKEN = os.getenv("HF_ACCESS_TOKEN")
|
16 |
-
MODEL_NAME = ""
|
17 |
-
BATCH_SIZE = 8
|
18 |
-
# FILE_LIMIT_MB = 1000
|
19 |
|
20 |
# --- Инициализация ---
|
21 |
try:
|
@@ -23,7 +20,7 @@ try:
|
|
23 |
login(token=HF_TOKEN)
|
24 |
print("Успешный вход в Hugging Face Hub.")
|
25 |
else:
|
26 |
-
print("HF_ACCESS_TOKEN не найден. Запуск в оффлайн-режиме или с публичными моделями.")
|
27 |
except Exception as e:
|
28 |
print(f"Не удалось войти в Hugging Face Hub: {e}")
|
29 |
|
@@ -36,16 +33,18 @@ class BasicAgent:
|
|
36 |
def __init__(self):
|
37 |
print("BasicAgent initialized.")
|
38 |
|
39 |
-
self.agent =
|
40 |
-
|
41 |
-
|
42 |
-
)
|
43 |
-
|
44 |
print("Agent initialized successfully.")
|
45 |
|
46 |
def __call__(self, question: str) -> str:
|
47 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
48 |
fixed_answer = self.agent.run(question)
|
|
|
49 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
50 |
return fixed_answer
|
51 |
|
|
|
13 |
|
14 |
# --- Конфигурация ---
|
15 |
HF_TOKEN = os.getenv("HF_ACCESS_TOKEN")
|
|
|
|
|
|
|
16 |
|
17 |
# --- Инициализация ---
|
18 |
try:
|
|
|
20 |
login(token=HF_TOKEN)
|
21 |
print("Успешный вход в Hugging Face Hub.")
|
22 |
else:
|
23 |
+
print("HF_ACCESS_TOKEN не найден. Запуск в оффлайн-режиме или с публичными моделями.")
|
24 |
except Exception as e:
|
25 |
print(f"Не удалось войти в Hugging Face Hub: {e}")
|
26 |
|
|
|
33 |
def __init__(self):
|
34 |
print("BasicAgent initialized.")
|
35 |
|
36 |
+
self.agent = CodeAgent(tools=[search_tool],
|
37 |
+
model=InferenceClientModel(model_id="Qwen/Qwen2.5-72B-Instruct"),
|
38 |
+
planning_interval=3
|
39 |
+
)
|
40 |
+
|
41 |
print("Agent initialized successfully.")
|
42 |
|
43 |
def __call__(self, question: str) -> str:
|
44 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
45 |
+
|
46 |
fixed_answer = self.agent.run(question)
|
47 |
+
|
48 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
49 |
return fixed_answer
|
50 |
|